rcp(1)
Requires Optional ARPA Services Software
NAME
rcp − remote file copy
SYNOPSIS
rcp [−p] file1 file2
rcp [−p] [−r] file1 [file2 ...] directory
DESCRIPTION
rcp copies files between hosts. Each file or directory argument is either a remote file name of the form hostname:path, or a local file name (with a / before any :). hostname can be either an official host name or an alias (see hosts(4)). If hostname is of the form ruser@rhost, ruser is used on the remote host instead of the current user name. An unspecified path (i.e. hostname:) refers to the remote user’s login directory. If path does not begin with /, it is interpreted relative to the remote user’s login directory on hostname. Shell metacharacters in remote paths can be quoted with backslash (\), single quotes (”), or double quotes ( "" ), so that they will be interpreted remotely.
If the −r option is specified and any of the source files are directories, rcp recursively copies each subtree rooted at that source directory name to the destination, which must be a directory. If file1 is a directory and directory is an existing directory, rcp creates the directory file1 within directory and copies the subtree rooted at file1 to directory/file1. If directory does not exist, rcp creates it and copies the subtree rooted at file1 to directory.
By default, rcp preserves the mode and owner of file2 if it already exists; otherwise rcp uses the mode of the source file modified by the umask(2) on the destination host. The modification and access times of the destination file are set to the time the copy was made. With the −p option, rcp attempts to preserve (duplicate) in its copies the modification times and modes of the source files, ignoring the umask. rcp only preserves the sticky bit if the target user is super-user.
rcp does not prompt for passwords. The current local user name or any user name specified via ruser must exist on rhost and allow remote command execution via remsh(1) and rcmd(3). remshd(1M) must be executable on the remote host.
Third-party transfers in the form:
"rcp ruser1@rhost1:path1 ruser2@rhost2:path2
are performed as:
remsh rhost1 −l ruser1 rcp path1 ruser2@rhost2:path2
Therefore, for a such a transfer to succeed, ruser2 on rhost2 must allow access by ruser1 from rhost1 (see hosts.equiv(4)).
WARNINGS
rcp is confused by any output generated by commands in a .cshrc file on the remote host (see csh(1)).
Copying a file to itself, for example:
rcp path ‘hostname‘:path
may produce inconsistent results. The current HP-UX version of rcp simply copies the file over itself. However, some implementations of rcp, including some earlier HP-UX implementations, corrupt the file. In addition, the same file may be referred to in multiple ways, for example, via hard links, symbolic links, NFS, or in an HP-UX clustered environment. It is not guaranteed that rcp will correctly copy a file over itself in all cases.
Implementations of rcp based on the 4.2BSD version (including the implementations of rcp prior to HP-UX 7.0) require that remote users be specified as rhost.ruser. If the first remote host specified in a third party transfer (rhost1 in the example below) uses this older syntax, the command must have the form:
rcp ruser1@rhost1:path1 rhost2.ruser2:path2
since the target is interpreted by rhost1. A common problem that is encountered is when two remote files are to be copied to a remote target that specifies a remote user. If the two remote source systems, rhost1 and rhost2, each expect a different form for the remote target, the command:
rcp rhost1:path1 rhost2:path2 rhost3.ruser3:path3
will certainly fail on one of the source systems. Perform such a transfer using two separate commands.
AUTHOR
rcp was developed by the University of California, Berkeley.
SEE ALSO
cp(1), ftp(1), remsh(1), remshd(1M), rcmd(3), hosts(4), hosts.equiv(4).
Hewlett-Packard Company — HP-UX Release 8.05: June 1991