RCP(TC) UNIX System V
Name
rcp - Remote file copy
Syntax
rcp [ -r ] [ -p ] file1 [ file2 ... ] target
Description
rcp copies files between two nodes. rcp works like the cp
command (see cp(C)), with some extensions.
file1 is copied to target. If target is a directory, one or
more files are copied into that directory; the copies have
the same names as the originals.
File and directory names follow a convention which is an
extension of the normal UNIX convention. Names take one of
three forms:
user@host:path
host:path
path
where
host is the name of the system which contains or will
contain the file. If no host is specified (the
simple path form of the name), the system on
which the command is executed is assumed.
user is the name of a user on the specified system.
If no user is specified in the name, then the
user on the remote system whose name is the same
as the user who executed the rcp command is
used. (That is, this rule applies if the
host:path or path form of the name was used.)
Access to the file system is as if by the
specified user who has just logged in. Created
files belong to the specified user and the
specified user's group (taken from the password
file). File and directory modifications can
only occur if the specified user has permission
to make them. If path does not begin with a
slant (/), it is assumed to be relative to the
specified user's home directory.
For you to use a user name on a remote system,
the remote system must have declared it
equivalent to your user name. See rhosts(SFF).
path is a conventional UNIX path name. Path can
include file-name-generation sequences (*, ?,
[...]); it may be necessary to quote these to
prevent their expansion on the local system.
The -r (recursive) option copies directory hierarchies. If
a file specified for copying is a directory and -r is
specified, the entire hierarchy under it is copied. When -r
is specified, target must be a directory.
When -r is not specified, copying directories is an error.
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(SSC) 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.
Note that a third system (not the source or target system of
the copy) can execute rcp.
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 mike's home directory on
beta to /usr/tmp on gamma; the copy on gamma is to belong to
deb. Both mike and deb must have previously declared fred
on alpha equivalent to their own user names; see
rhosts(SFF).
rcp mike@beta:file deb@gamma:/usr/tmp
Note that junk is not placed in deb's home directory because
the path part of the name begins with a slash.
Files
/etc/hosts.equiv
$HOME/.rhosts
See Also
ftp(TC)
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 confused. This is never a problem with sh(C),
because it is not called as a log-in shell.
The -r option doesn't work correctly if the copy is purely
local, because it relies on underlying support from cp ,
which is only available on BSD-derived systems. Use
cpio(C), instead.
(printed 8/17/89) RCP(TC)