rcp Command Purpose Transfers files between a local and a remote host or between two remote hosts. Syntax rcp [ -p] { { User@Host:File | Host:File | File } { User@Host:File | Host:File | File | User@Host:Directory | Host:Directory | Directory } | [ -r] { User@Host:Directory | Host:Directory |Directory } { User@Host:Directory | Host:Directory | Directory } } Description The /usr/bin/rcp command is used to copy one or more files between the local host and a remote host, between two remote hosts, or between files at the same remote host. Remote destination files and directories require a specified Host: parameter. If a remote host name is not specified for ei- ther the source or the destination, the rcp command is equivalent to the cp command. Local file and directory names do not re- quire a Host: parameter. Note: Because the rcp command assumes that a : (colon) terminates a host name, you must insert a \ (backslash) before any colons that are embedded in the local file and directory names. If a Host is not prefixed by a User@ parameter, the local user name is used at the remote host. If a User@ parameter is en- tered, that name is used. If the path for a file or directory on a remote host is not specified or is not fully qualified, the path is interpreted as beginning at the home directory for the remote user account. Ad- ditionally, any metacharacters that must be interpreted at a re- mote host must be quoted using a \ (backslash), a " (double quo- tation mark), or a ' (single quotation mark). File Permissions and Ownership By default, the permissions mode and ownership of an existing destination file are preserved. Normally, if a destination file does not exist, the permissions mode of the destination file is equal to the permissions mode of the source file as modified by the umask command (a special command in the Korn shell) at the destination host. If the rcp command -p flag is set, the modif- ication time and mode of source files are preserved at the desti- nation host. The user name entered for the remote host determines the file ac- cess privileges the rcp command uses at that host. Additionally, the user name given to a destination host determines the owner- ship and access modes of the resulting destination file or files. The remote host allows access if one of the following conditions is satisfied: * The local host is included in the remote host /etc/hosts.equiv file and the remote user is not the root user. * The local host and user name is included in a $HOME/.rhosts file on the remote user account. For security reasons, any $HOME/.rhosts file must be owned by ei- ther the remote user or root user and should allow write access only by the owner. In addition to the preceding conditions, the rcp command also al- lows access to the remote host if the remote user account does not have a password defined. However, for security reasons, the use of a password on all user accounts is recommended. rcp and Named Pipelines Do not use the rcp command to copy named pipelines, or FIFOs, (special files created with the mknod -p command).The rcp command uses the open subroutine on the files that it copies, and this subroutine blocks on blocking devices like a FIFO pipe. Flags -p Preserves the modification times and modes of the source files in the copies sent to the destination only if the user has root authority or is the owner of the destination. Without this flag, the umask command at the destination modifies the mode of the destination file, and the modification time of the destination file is set to the time the file is received. When this flag is not used, the umask being honored is the value stored in the appropriate database. It is not the value that is set by issuing the umask command. The permission and ownership values that result from the umask command do not affect those stored in the database. -r Recursively copies, for directories only, each file and sub- directory in the source directory into the destination directory. Parameters Host:File Specifies the host name (Host) and file name (File) of the remote destination file, separated by a : (colon). Note: Because the rcp command assumes that a : (colon) terminates a host name, you must insert a \ (backslash) before any colons that are embedded in the local file and directory names. User@Host:File Specifies the user name (User@) that the rcp com- mand uses to set ownership of the transferred file, the host name (Host), and file name (File) of the remote destination file. The user name entered for the remote host determines the file access privileges the rcp command uses at that host. File Specifies the file name of the local destination file. Host:Directory Specifies the host name (Host) and directory name (Directory) of the remote destination directory. Note: Because the rcp command assumes that a : (colon) terminates a host name, you must insert a \ (backslash) before any colons that are embedded in the local file and directory names. User@Host:Directory Specifies the user name (User@) the rcp com- mand uses to set ownership of the transferred file, the host name (Host), and directory name (Directory) of the remote destination directory. The user name entered for the remote host determines the file access privileges the rcp command uses at that host. Directory The directory name of the local destination directory. Examples In the following examples, the local host is listed in the /etc/hosts.equiv file at the remote host. 1. To copy a local file to a remote host, enter: rcp localfile host2:/home/eng/jane The file localfile from the local host is copied to the remote host host2. 2. To copy a remote file from one remote host to another remote host, enter: rcp host1:/home/eng/jane/newplan host2:/home/eng/mary The file /home/eng/jane/newplan is copied from remote host host1 to remote host host2. 3. To send the directory subtree from the local host to a remote host and preserve the modification times and modes, enter: rcp -p -r report jane@host2:report The directory subtree report is copied from the local host to the home directory of user jane at remote host host2 and all modes and modification times are preserved. The remote file /home/jane/.rhosts includes an entry specifying the local host and user name. Implementation Specifics This command is part of the TCP/IP Facility in Network Facilities in Base Operating System (BOS) Runtime. Related Information Network Overview in AIX Version 3.2 System Management Guide: Communications and Networks. The cp command, ftp command, rlogin command, rsh command, tftp command, umask command. The rshd daemon. The .rhosts file format, hosts.equiv file format.