RCP – Remote Copy Protocol Is used to copy files between two Unix/Linux systems. We do not recommend using this utility since it is unsecured and sends data over network without encryption.
However if you do require to use this utility , here is how to set this up on CentOS based system.
- Install 2 packages rsh and rsh-server. The rsh-server package contains a set of programs which allow users to run commands on remote machines, login to other machines, and copy files between machines (respectively, rsh, rlogin, and rcp).
xinetdservice which listens for incoming requests over a network and launches the appropriate service for that request.
- Create 2 files on each host that will need to copy files to and from. The file names are .rhost and this hidden files will include users and hosts that will be allowed to copy files.
1. We start by installing nessesary packages using yum manager.
# yum install rsh-server rsh -y
2. Now we edit and enable 3 configuration files.
vi /etc/xined.d/rsh vi /etc/xined.d/rlogin vi /etc/xined.d/rexec change disable = no
3. In the home directory of user create .rhosts files that will have all computer and user information. You can use ip addressed or FQDN DNS names.
In this example we will add user john and computer named system1
cd /home/%yourusername% vi .rhosts add the following system1 john
How to use rcp
rcp doc1 system1.tekyhost.com:doc1 #This example copies doc1 from local system to users home directory on system1.tekyhost.com rcp doc1 john:system1.tekyhost.com:doc1 #Copies "doc1" from the local machine to the home directory of user "john" on the remote system rcp system1.tekyhost.com:doc1 doc1 #Copies doc1 from remote system to local system
If any of the source files are directories, copies each subtree rooted at that name; in this case the destination must be a directory.
The option causes rcp to attempt to preserve (duplicate) in its copies the modification times and modes of the source files, ignoring the umask By default, the mode and owner of file2 are preserved if it already existed; otherwise the mode of the source file modified by the umask(2) on the destination host is used.