rcp

remote file copy 

Command


SYNOPSIS

rcp [-Dp] file1 file2

rcp -r [-Dp] file1 ... filen directory


DESCRIPTION

rcp copies files between machines. Each file or directory argument is either a remote file name of the form

[rname@]rhost:path

or a local file name.

If path is not a full path name, it is interpreted relative to the HOME directory of the specified user rname on rhost. The local user name (that is, the name you are currently logged in as) including either your domain name (or your machine name if you are not a domain user) is used as rname if no other remote user name is specified.

Note:

rcp uses the colon (:) to separate the host name and path name which can create problems when you want to specify local file names which contain a colon following a drive letter. As a result, when a file argument on the command line is of the x:path (that is, a single letter followed by a colon and a path name), rcp treats the argument as path on drive x of the local system as opposed to path on a host named x. As an alternative, you can specify local file names on a rcp command line, by using an equal sign (=) in place of the colon and prefixing the name with a slash. For example, you could specify the local file c:/testfile as /c=/testfile.

rcp does not prompt for passwords; it performs remote execution using rsh and requires the same authorization as that command. The rsh reference page provides additional information on how rsh communicates with a rshd service (or daemon) to execute commands remotely.

If an attempted rcp connection to the host fails because of an error matching "permission.*denied" or "remuser too long in a case-insensitive manner, the utility immediately tries again, sending only the user name without domain (or machine) information.

Note:

Because the rsh and rcp utilities resend the current without the domain if it is too long and the rlogin utility does not, a user may require two entries in the hosts.equiv or .rhosts file. If the full name (including domain) is too long for the rshd service (or daemon) being used, the user needs one entry with the full user name (including domain) for use with rlogind and a second with the the same user name minus the domain for use with rshd.

rcp handles third party copies, where neither source nor target files are on the current machine.

If rcp fails with a TIMEOUT error on Windows 7/2008R2/8/2012/10/2016 when it should have succeeded, the user can tell rcp to retry with:

export TK_WORK_AROUND_VISTA_TIMEOUT_BUG=1

A TIMEOUT error is indicated by the following error message:

A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond.

Options

-D 

enables socket debugging on the TCP sockets used for communication with the remote host.

-p 

attempts to preserve (duplicate) the modification times and modes of the source files in the copies created. By default, the mode and owner of the destination file (file2) are preserved if the file already existed; otherwise, the mode of the source file (file1) modified by the umask on the destination host is used.

-r 

treats the last command line argument as the target directory and copies all preceding arguments (that is, the source files) to that directory. If any of the source files are directories, rcp copies each subtree rooted at that name to the target directory.

Troubleshooting

Because rcp connects to a rshd service (or daemon), the information provided in the Troubleshooting section of the rsh reference page may prove useful should problems arise.


ENVIRONMENT VARIABLES

TK_RETRY_ON_WSAENOTSOCK 

When this environment varible is set, the rsh, rcp, rexec, and rlogin utilities retry up to five times if they get the WSAENOTSOCK error. The WSAENOTSOCK error is reported as:

An operation was attempted on something that is not a socket
TK_WORK_AROUND_VISTA_TIMEOUT_BUG 

when set, rcp retries to establish a connection when it fails with a TIMEOUT error on Windows 7/2008R2/8/2012/10/2016.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


NOTE

When the destination machine is running the BSD 4.2 version of rcp, the destination user and host name may have to be specified as rhost.rname.


ACKNOWLEDGEMENT

This product includes software developed by the University of California, Berkeley and its contributors.


PORTABILITY

All UNIX systems. Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.

Linux and UNIX versions of rcp do not support including domain information in rname. This functionality is an MKS extension.


AVAILABILITY

PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
cp, rsh, rshd

File Formats:
hosts.equiv, rhosts

MKS Toolkit Connectivity Solutions Guide


PTC MKS Toolkit 10.1 patch 1 Documentation Build 2.