rcp

This connectivity command copies files between a Window NT computer and a system running rshd, the remote shell server. The rcp command can also be used for third-party transfer to copy files between two computers running rshd when the command is issued from a Windows NT computer. The rshd server is available on UNIX computers, but not on Windows NT, so the Windows NT computer can only participate as the system from which the commands are issued.

Syntax

rcp [-a | -b] [-h] [-r] source1 source2 ... sourceN destination

Parameters

-a

Specifies ASCII transfer mode. This mode converts the carriage return/linefeed characters to carriage returns on outgoing files, and linefeed characters to carriage return/linefeeds for incoming files. This is the default transfer mode.

-b

Specifies binary image transfer mode. No carriage return/linefeed conversion is performed.

-h

Transfers source files marked with the hidden attribute on the Windows NT computer. Without this option, specifying a hidden file on the rcp command line has the same effect as if the file did not exist.

-r

Recursively copies the contents of all subdirectories of the source to the destination. Both the source and destination must be directories.

source and destination

Must be of the form [host[.user]:]filename. If the [host[.user]:] portion is omitted, the host is assumed to be the local computer. If the user portion is omitted, the currently logged on Windows NT username is used. If a fully qualified host name is used, which contains the period (.) separators, then the [.user] must be included. Otherwise, the last part of the hostname is interpreted as the username. If multiple source files are specified, the destination must be a directory.

If the filename does not begin with a forward slash ( / ) for UNIX or a backward slash ( \ ) for Windows NT systems, it is assumed to be relative to the current working directory. On Windows NT, this is the directory from which the command is issued. On the remote system, it is the logon directory for the remote user. A period (.) means the current directory. Use the escape characters ( \ , ", or ') in remote paths to use wildcard characters on the remote host.

Notes

Remote Privileges

The rcp command does not prompt for passwords; the current or specified user name must exist on the remote host and enable remote command execution via rcp.

The .rhosts file specifies which remote system or users can assess a local account using rsh or rcp. This file (or a HOSTS equivalent) is required on the remote system for access to a remote system using these commands. Rsh and rcp both transmit the local username to the remote system. The remote system uses this name plus the IP address (usually resolved to a host name) or the requesting system to determine whether access is granted. There is no provision for specifying a password to access an account using these commands.

If the user is logged on to a Windows NT Server domain, the domain controller must be available to resolve the currently logged on name, because the logged on name is not cached on the local computer. Because the username is required as part of the rsh protocol, the command fails if the username cannot be obtained.

The .rhosts File

The .rhosts file is a text file where each line is an entry. An entry consists of the local host name, the local user name, and any comments about the entry. Each entry is separated by a tab or space, and comments begin with a hash mark (#), for example:



computer5 marie #This computer is in room 31A

The .rhosts file must be in the user's home directory on the remote computer. For more information about a remote computer's specific implementation of the .rhosts file, see the remote system's documentation.

Additionally, have your host name added to the remote system's /ETC/HOSTS file. This enables the remote system to authenticate remote requests for your computer using the Microsoft TCP/IP utilities.

Specifying Hosts

Use the host.user variables to use a user name other than the current user name. If host.user is specified with source, the .rhosts file on the remote host must contain an entry for user. For example,



rcp rhino.johnb:file1 buffalo.admin:file2

The .rhosts file on BUFFALO should have an entry for Johnb on RHINO.

If a host name is supplied as a full domain name containing dots, a user name must be appended to the host name, as previously described. This prevents the last element of the domain name from being interpreted as a user name. For example,


rcp domain-name1.user:johnm  domain-name2.user:billr

Remote Processing

Remote processing is performed by a command run from the user's logon shell on most UNIX systems. The user's .profile or .cshrc is executed before parsing filenames, and exported shell variables can be used (using the escape character or quotation marks) in remote filenames.

Copying Files

If you attempt to copy a number of files to a file rather than a directory, only the last file is copied. Also, the rcp command cannot copy a file onto itself.

Examples

These examples show syntax for some common uses of rcp.

To copy a local file to the logon directory of a remote computer:



rcp filename remotecomputer:

To copy a local file to an existing directory and a new filename on a remote computer:



rcp filename remotecomputer:/directory/newfilename

To copy multiple local files to a subdirectory of a remote logon directory:



rcp file1 file2 file3 remotecomputer:subdirectory/filesdirectory

To copy from a remote source to the current directory of the local computer:



rcp remotecomputer:filename .

To copy from multiple files from multiple remote sources to a remote destination with different usernames:



rcp remote1.user1:file1 remote2.user2:file2 remotedest.destuser:directory

To copy from a remote system using an IP address to a local computer (where the username is mandatory because a period is used in the remote system name):



rcp 11.101.12.1.user:filename filename