rcp -- remote file copy


rcp [ -p ] file1 file2

rcp [ -p ] [ -r ] file ... directory


rcp copies files between two machines. Each file or directory argument is either a remote file/directory name of the form ``rhost:path'' or a local file/directory name (containing no ``:'' characters or containing a ``/'' before any ``:'');

If the -r option is specified and any of the source files are directories, rcp copies each subtree rooted at that name; in this case the destination must be a directory.

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 on the destination host is used. (See umask(C) for a description of umasks.) The -p option causes rcp to attempt to preserve (duplicate) in its copies the modification times and modes of the source files, ignoring the umask.

If path is not a full path name, it is interpreted relative to your login directory on rhost. A path on a remote host may be quoted (using \, ", or ´) so that the metacharacters are interpreted remotely. See sh(C) for quoting rules.

rcp does not prompt for passwords; if the user account requires a password, your current local user name must exist on rhost and allow remote command execution via rcmd(TC).

If an account has no password, any user can use rcmd or rcp commands to access that account. In this case, an entry in /etc/hosts.equiv or in a .rhosts file is not required.

rcp handles third-party copies, where neither source nor target files are on the current machine. Hostnames may also take the form ``rname@rhost'' to use rname rather than the current user name on the remote host.

Authenticated rcp using Kerberos

Authenticated rcp attempts to connect to a different port (kshell) than the standard shell port. kshell is assigned to port 544/tcp in /etc/services.

rcp attempts to connect to kshell port on the remote host. If the connection to the kshell port succeeds in reaching an authenticated rshd server, then rcp will establish authentication (using krb5_sendauth). If rcp cannot connect to kshell, it will abort the connection and retry using the standard shell port.

To execute authenticated rcp, the user must have network credentials, and the user's principal name must appear in the $HOME/.k5login file on the remote host (this file must be writable only by the user or by root, and it must be readable by root in the filesystem where it resides).


The following examples are executed on system alpha, by user fred. alpha is networked to beta and gamma.

The first example copies list from fred's home directory on alpha to fred's home directory on beta.

rcp list beta:list

The next example copies a directory hierarchy. The original is rooted at src in fred's home directory on beta. The copy is to be rooted in src in the working directory.

rcp -r beta:src .

Finally, fred copies a file from diane's home directory on beta to /usr/tmp on gamma; the copy on gamma is to belong to karl. Both diane and karl must have previously declared fred on alpha equivalent to their own user names; see hosts.equiv(SFF).

rcp beta.diane:junk gamma.karl:/usr/tmp

Note that junk is not placed in karl's home directory because the path part of the name begins with a slash.


Most diagnostics are self-explanatory. Permission denied means either that the remote user does not have permission to do what you want or that the remote user is not equivalent to you.


Both nodes involved in the copy must be running the rshd(ADMN) server.

If a remote shell invoked by rcp has output on startup, rcp will get confused. This is never a problem with sh(C), because it is not called as a login shell.

The -r option does not work correctly if the copy is purely local, since it relies on underlying support from cp, which is only available on BSD derived systems. Use cpio(C), instead.

The destination user and hostname may have to be specified as ``rhost.rname'' when the destination machine is running a 4.2BSD derived version of rcp.

Authentication is based on Version 5 of the Kerberos Network Authentication Service protocol. Only this version of the protocol is supported.

Data encryption is not supported.


equivalent users for authenticated rcp

equivalent users

list of trusted hosts

list of Internet services

See also

ftp(TC), rcmd(TC),, rlogin(TC), rshd(ADMN), services(SFF)

Standards conformance

rcp is not part of any currently supported standard. It is an extension of AT&T UNIX System V provided by The Santa Cruz Operation, Inc.


A version of rcp that can handle files greater than 2GB is available in /u95/bin. See rcp(1tcp) for more information.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005