rcp -- remote file copy


rcp [-p] filename1 filename2
rcp [-pr] filename . . . directory


The rcp command copies files between machines.


rcp takes the following options:

Attempt to give each copy the same modification times, access times, and modes as the original file.

Copy each subtree rooted at filename; in this case the destination must be a directory.


language-specific message file (See LANG on environ(5).)


Each filename or directory argument is either a remote file name of the form:


or a local file name (containing no ``:'' characters, or a ``/'' before any ``:'' characters).

If filename is not a full path name, it is interpreted relative to your home directory on hostname. A path on a remote host may be quoted (using ``\'', ``"'', or ``''') so that the metacharacters are interpreted remotely.

rcp does not prompt for passwords; your current local user name must exist on hostname and allow remote command execution by rsh(1tcp).

rcp handles third party copies, where neither source nor target files are on the current machine. Hostnames may also take the form


to use username rather than your current local user name as the user name on the remote host. rcp also supports Internet domain addressing of the remote host, so that:


specifies the username to be used, the hostname, and the domain in which that host resides. Filenames that are not full path names will be interpreted relative to the home directory of the user named username, on the remote host.

The destination hostname may also take the form hostname.username:filename to support destination machines that are running older versions of rcp.

Each remote machine may have a file named /etc/hosts.equiv containing a list of trusted host names with which it shares user names. Users with the same user name on both the local and remote machine may rcp from the machines listed in the remote machine's /etc/hosts.equiv file without supplying a password. Individual users may set up a similar private equivalence list with the file .rhosts in their home directories. Each line in this file contains two names: a hostname and a username separated by a space. An entry in a remote user's .rhosts file permits the user named username who is logged into hostname to use rcp to access the remote machine as the remote user without supplying a password. If the name of the local host is not found in the /etc/hosts.equiv file on the remote machine, and the local user name and host name are not found in the remote user's .rhosts file, then the rcp command will fail with the diagnostic message Permission denied. Hostnames listed in /etc/hosts.equiv and .rhosts files must be the official host names listed in the hosts data base; nicknames may not be used in either of these files.

To counter security problems, the .rhosts file must be owned by either the remote user or by a privileged user.


rcp is meant to copy between different hosts; attempting to rcp a file onto itself, as with:

rcp tmp/file myhost:/tmp/file

results in a severely corrupted file.

rcp does not detect all cases where the target of a copy might be a file in cases where only a directory should be valid.

rcp requires that the source host have permission to execute commands on the remote host when doing third-party copies.

If you forget to quote metacharacters intended for the remote host, you get an incomprehensible error message.


ftp(1tcp), hosts.equiv(4tcp), rlogin(1tcp), rsh(1tcp), rshd(1Mtcp)


The rcp command has been updated to handle files larger than 2GB.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004