Sams Teach Yourself TCP/IP in 24 Hours (4th Edition)

The rcp command provides an alternative to ftp; it allows users to copy files over the network. The rcp command is the remote version of the Unix cp (copy) command. When using the rcp command, you do not need to supply a user ID or password; this might be considered a security hole. However, a level of security is provided by the fact that the name of your computer must reside in either of two server-based files named rhosts and hosts.equiv. The rcp command allows a user to copy files between a local computer and the host server or between two remote computers. The syntax for the rcp command is

rcp [hostname1]:filename1 [hostname2]:filename2

  • hostname1 Optionally indicates the hostname or Fully Qualified Domain Name (FQDN) of the source computer. Use this hostname if the source file is located on a remote computer. See Hour 11, "Name Resolution," for more on hostnames and FQDNs.

  • filename1 Indicates the path and filename of the source file.

  • hostname2 Optionally indicates the hostname or FQDN of the destination computer. Use this hostname if the destination file is located on a remote computer.

  • filename2 Indicates the path and filename of the destination file.

The following are three examples using the rcp command.

This example copies a file from the remote Unix computer to the local host:

rcp server3.corporate.earthquakes.txt earthquakes.txt

This example copies a file from the local host to a remote computer:

rcp earthquakes.txt server3.corporate.earthquakes.txt

You can also use rcp to copy a file from one remote host to another remote host. See Hour 15, "Remote Access Utilities," for more on rcp and other remote access options.

Категории