rcp(TC) 19 June 1992 rcp(TC) Name rcp - remote file copy Syntax rcp [ -p ] file1 file2 rcp [ -p ] [ -r ] file ... directory Description rcp copies files between two machines. Each file or directory argument is either a remote file name of the form ``rhost:path'', or a local file name (containing no ``:'' characters, or a ``/'' before any ``:''); If the -r option is specified and any of the source files are direc- tories, 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(SLIB) on the destination host is used. 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. rcp does not prompt for passwords; your current local user name must exist on rhost and allow remote command execution via rcmd(TC). 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. Files /etc/hosts.equiv $HOME/.rhosts Examples 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 rhosts(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. Requirements Both nodes involved in the copy must be running the rshd(ADMN) server. Diagnostics 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. Warnings If a remote shell invoked by rcp has output on startup, rcp will get con- fused. 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. See also ftp(TC), rcmd(TC), rlogin(TC).