The rcp can be used to copy files and directories
from a local host to a remote host
from a remote host to a local host
between two remote hosts
You can use this command, for example, when you want to work with files located on a remote host. The rcp command can be used symmetrically by BS2000-POSIX and remote Unix systems.
Format 1 of the command copies a single file from one host to a file on another host.
Format 2 of the rcp command copies multiple files or a directory of another host.
The rcp command can only be used by users with access authorization on the remote host. In other words, the .rhosts file in the HOME directory of the ID on the remote host must have an entry containing the name of the local host or a plus character (+) and the user ID. The user ID must have a standard account number for rlogin access. This standard account number can be assigned using the ADD-USER, MODIFY-USER-ATTRIBUTES or ADD-POSIX-USER command.
The files /etc/hosts and /etc/hosts.equiv usually used in Unix systems are not used in POSIX. The assignment of host names to IP addresses is handled via BCAM or DNS.
Syntax
Format 1: |
rcp[
-p][
-b] file1 file2 |
Format 2: |
rcp[
-pr][
-b] file ... dir |
Copy individual files
No option specified The modification and access times of each copy are set to the current time. The access permissions are set in accordance with umask.
Every copy receives the same modification and access times and the same access permissions as the original file.
The file is transferred in binary mode.
is the file to be copied. This file may be stored on the local or remote host. If the file is stored on the local host, it may be specified with path, where path is the pathname of file1. If path is not an absolute pathname, it is interpreted as a relative path to the current directory. If the file is stored on a remote host, file1 must be specified in the following format:
remote_host is the name of the remote host or its IP address in IPv4 or IPv6 dot notation:
The alternative presentation methods described in RFC 2373 are permissible for IPv6 dot notation.
Otherwise the first colon in the IPv6 address would be incorrectly interpreted as a separator between the host name and the path name. login is the user ID on the remote host. path is the pathname of file1. domain is the name of the DNS domain to which the remote host belongs. Pathnames may include the usual metacharacters (e.g. *, ?) for constructing file names. These metacharacters are evaluated on the local host. path must not contain a colon ":", and the string for login@remote_host must not include a slash "/".
is the file to which the source file is to be copied. This file may be placed on the local or remote host. If the file already exists, it will be overwritten. The format is the same as for file1. |
Copy multiple files or directories
No option specified The modification and access times of each copy are set to the current time. The access permissions are set in accordance with umask.
Every copy receives the same modification and access times and the same access permissions as the original file.
All subdirectories of dir are copied recursively. In this case, file must be a directory.
The file is transferred in binary mode.
may be
on the local or remote host. The following format applies on the local host:
or
filename is the respective name or pathname of one or more files. If file is located on the remote host, the following applies:
remote_host is the name of the remote host. login is the user ID on the remote host. path is the pathname of file1. domain is the name of the DNS domain to which the remote host belongs. Pathnames may include the usual metacharacters (e.g. *, ?) for constructing file names. These metacharacters are evaluated on the local host. Example
copies all files that match the first pathname into the specified directory.
is the directory to which the files or directories are to be copied. This directory may be located on the local or remote host. Files of the same name, if any, are overwritten. The format for dir on the remote host is:
The format for dir on the remote host is:
or
|
Error
The host is not known to BCAM or only known under another alias.
|
File
$HOME/.rhosts List of host names and user IDs that can log on to them under those IDs. |
Example 1
The POSIX user john wants to copy the file test from his current directory to the user john on the remote host rainbow. The copied file is to be named john_test on the remote host rainbow. The required access permissions for the copy operation are present.
|
Example 2
The POSIX user john copies the directories test and practice from the login name john on the host rainbow to the POSIX directory /home/john/rainbow_copy.
|
See also
rsh |