7. RCP: Copying Files

Introduction

The Remote Copy Program (RCP) is a command you can use to copy files between your local OpenVMS host and a remote host. TCPware provides RCP as part of the FTP-OpenVMS product.

For the FTP utility commands, see Chapter 3, FTP: Transferring Files. Use the RCP command to copy remote files. You can copy files:

  From a remote host to your host

  From your host to a remote host

  From one remote host to another remote host (a "third-party" copy)

CAUTION!     If you are using RCP with Kerberos version 4 authentication in a third-party copy, only the first connection uses Kerberos. The second connection uses standard authentication, in which case the username and password pass through the network as clear text.

Before you use RCP, your system manager must install and configure the TCPware FTP-OpenVMS product and enable the shell service during TCPware R Services configuration.

Also, make sure your host or username is registered in the remote system's ~/.rhosts (if UNIX) or SYS$LOGIN:.RHOSTS file (if OpenVMS). To use Kerberos version 4 authentication with the remote host, be sure your username and Kerberos realm are in the remote host's ~/.klogin file (if UNIX) or SYS$LOGIN:.KLOGIN file (if OpenVMS).

To use Kerberos version 4 authentication, your system manager must enable the kshell service during TCPware's Kerberos Services configuration. If you request Kerberos authentication, RCP tests for it first. If the test fails, RCP uses standard authentication instead.

With Kerberos V4 authentication, you can specify the Kerberos realm using the /REALM qualifier. If omitted, the TCPWARE_KERBV4_REALM logical value determines the realm.

If you need to preserve case for any of the command elements, enclose each in quotes, since RSH lowercases unquoted text strings. Include a pair of quotes for each redirection of the command. If you are redirecting a command through one remote host to have it executed on a third, each host in turn strips off a pair of quotes after interpreting the command. In this case, you may need three pairs of quotes around the command element in order to preserve case.


 

RCP

Copies files between the local and remote host, or between two remote systems.

Format

RCP source destination

Parameters

source

Source host and pathname information, in the general format:

host:filespec

  host is the remote host name followed by a colon (:).

  filespec is different for UNIX and OpenVMS systems:

     For UNIX system source hosts, use the absolute pathname (such as /etc/user/hosts) or the one relative to the user's home directory (hosts).

     For OpenVMS source hosts, use the format[dir]file.typ, or file.typ, which assumes the current directory.

If you include a username or device, use the following format:

"username@host:device:filespec"

If you include a username and want to copy from a remote host, the remote host must include your host (and username) in its host equivalence file. If you do not use the above format, use the /USER, /PASSWORD, and /TRUNCATE qualifiers.

Note!     Do not use /USER or /PASSWORD when using DECnet syntax for a source or destination:
host"username password"::filespec
You also cannot use DECnet syntax for both source and destination (as for a remote-to-remote copy) that involves two passwords.

destination

Destination host and pathname information, in the same format as source.

Qualifiers

/AUTHENTICATION[=auth-type]

Determines the authentication method. If KERBV4 (or you omit the value), uses Kerberos v4 authentication. If NULL (or you omit the qualifier), uses standard authentication.

/LOG

Logs the files copied to or from the local system. The default is not to log. Logging only applies to the first remote host transaction in a third-party copy.

/VMS[={MULTINET | TCPWARE (default)}]
/NOVMS

If /VMS is omitted, RCP by default attempts a TCPware style VMS mode transfer. This retains VMS file attributes across copies. Use /VMS=MULTINET to do a transfer involving a MultiNet machine. Use /NOVMS only if you get the error %DCL-W-IVKEYW, unrecognized keyword - check validity and spelling with the RCP command. /NOVMS disables maintaining VMS file attributes during a third-party copy.

/PASSWORD=remote-password

Password for the remote account. Use with the /USER qualifier. Do not use with DECnet source or destination syntax.

CAUTION!     The password is sent across the network as plain text.

/PRESERVE

-p

Preserves the file protection mode and modification date during a copy. /PRESERVE and -p are equivalent.

/REALM=realm

Assigns the name of the Kerberos realm. Use if the Kerberos Server resides in a different realm than the local host. Use with the /AUTHENTICATION=KERBV4 qualifier and value. The RCP client converts realm to lowercase unless you enclose it in quotes.

/RECURSIVE

-r

Recursively copies each subtree rooted at the directory you specify in the UNIX system filespec. This makes it possible to copy entire UNIX system directories and their files. In OpenVMS, specify [dir...] (with the three trailing dots) in the filespec instead of using /RECURSIVE. -r is the UNIX system equivalent.

/USER=remote-username

User on the remote host. Use only if the remote host's ~/.hosts or .HOSTS file does not include your local host name or username. If necessary, truncate username to the required number of characters using the /TRUNCATE qualifier. Converted to lowercase if not enclosed in quotes. Do not use with DECnet file syntax.

/TRUNCATE[=n]

Truncates the username to the specified n number of characters, since some UNIX systems restrict the length of usernames. If you omit n, the default is eight characters.

Examples

1   This command copies a remote UNIX system source file in its home directory to a local host file of the same name in the current directory. The copy preserves the source file's protection mode and modification date.

rcp /preserve unixhost:src_file []

2   This command copies the complete remote UNIX system directory tree ~/src_dir to the local subdirectory DST_DIR, while logging the copy of each file:

rcp /recursive/log unixhost:src_dir [.dst_dir...]

3   The first of these two commands only copies the .src_dir subdirectory to a UNIX system. The second command copies the whole subtree.

rcp /recursive [.src_dir] unixhost:dst_dir
rcp [.src_dir...] unixhost:dst_dir

4   This command copies the complete local subdirectory tree SRC_DIR to a remote OpenVMS host's destination directory while preserving the directory hierarchy:

rcp [src_dir...] vmshost:[dst_dir...]

5   This command copies all files under the local SRC_DIR directory to a remote OpenVMS host's destination directory. This does not preserve the copied directory's hierarchy:

rcp [src_dir...] vmshost:[dst_dir]

6   This command copies all directories and files under the local SRC_DIR directory to a remote OpenVMS host user's login directory on the DKA300: device (use the double quotes):

rcp [src_dir...] "vmshost:dka300:[login...]"

7   This command copies the local SRC_FILE on device DKA100: to dst_file on a remote host. Double quotes are needed to specify a device name. The /NOVMS qualifier allows RCP to copy compatibly to an OpenVMS host running HP TCP/IP Services for OpenVMS (UCX).

rcp /novms ":dka100:[src_dir]src_file" ucx_host:dst_file

8   This command copies the local SRC_FILE to ~some/dst_file if the remote host is a UNIX system, or [some-login-directory]DST_FILE if the remote host is OpenVMS. (RCP truncates the someone username to some.) In this case, the remote host does not have a host equivalence file entry for the local host, requiring /USER and /PASSWORD.

rcp /user=someone/pass=password/truncate=4 src_file host:dst_file

9   Each command copies a UNIX system file to the local host's current directory. The -p switch in the first command precludes having to use double quotes around the UNIX system file specification. The second command is the equivalent without the -p switch.

rcp -p unixhost:/usr/users/src_file []

rcp "unixhost:/usr/users/src_file" []

10     This command copies a file from one remote host to another (a "third-party" copy):

rcp remotehost1:file1 remotehost2:file2

11     This command copies a remote UNIX system source file in its home directory to the DST_FILE filename on the local host under the current directory. Uses Kerberos V4 authentication. The Kerberos Server and its database reside in the realm daisy.com.

rcp /auth=kerbv4 /realm=daisy.com unixhost:src_dir dst_file

12     This command copies all files under the local SRC_DIR directory to a remote OpenVMS host's destination directory while preserving the directory hierarchy. Since the
/AUTHENTICATION qualifier appears without a value, Kerberos V4 authenticates the user to the remote UNIX host. Because /REALM is omitted, the TCPWARE_KERBV4_REALM logical value determines the Kerberos realm.

rcp /auth [src_dir...] vmshost:[dst_dir...]

13     Using the /USER or /PASSWORD qualifier with DECnet syntax is not allowed and returns the error message shown:

rcp /user=user1 new.txt flower"user2 password"::new.txt
TCPWARE-E-NOQUAL, /USERNAME qualifier not allowed with DECnet syntax

14     Using multiple passwords with DECnet syntax is not allowed and returns the error message shown:

rcp tree"user1 pass1"::new.txt flower"user2 pass2"::new.txt
TCPWARE-E-MULTPW, Multiple passwords not supported