Transferring Files Between Systems (rcp, ftp)
| NOTE. Starting with the Solaris 9 release, Secure Shell is recommended for secure remote copy and file transfer protocol. See "Secure Shell Commands" on page 359 for more information. |
If the automounter is set up for your site, you can transfer files between systems by using commands such as cp and mv. This section describes how to use the rcp and ftp commands to transfer files between systems.
Using the rcp Command
To transfer a file from a remote system to your system with the remote copy command, type rcp system-name: source-pathname destination and press Return. If you have proper security to access the remote system, the file is copied to the destination you specify.
In the following example, the file quest is copied from the /tmp directory on the system ash to the current working directory on the system oak.
oak% rcp ash:/tmp/quest.
oak%
To transfer a file from a local system to a remote system, type rcp pathname system-name:destination-pathname and press Return. If you have proper security to access the remote system, the file is copied from the local system to the remote destination you specify.
In the following example, the file quest is copied from the current working directory on the system oak to the /tmp directory on the system ash.
oak% rcp quest ash:/tmp
oak%
If you want, you can rename the file as part of the destination path name. For example, to rename the file quest to questions and put it in the /tmp directory, type /tmp/questions as the destination path name.
Using the File Transfer Program (ftp)
Use the following steps to transfer files from your local system to a remote system by using the file transfer program.
NOTE. You may need to have an account on each system to use the file transfer program. Some systems allow read-only ftp access to anybody who logs in as anonymous and types a login name at the password prompt.
If you have an NIS, NIS+, or LDAP account, you can use your login name and network password to access a remote system by using ftp.
Type ftp and press Return.
The ftp> prompt is displayed.
Type open remote-system-name and press Return.
System connection messages are displayed, and you are asked for a user name.
Type the user name for your account on the remote system and press Return.
If a password is required, you are asked to enter it.
Type the password (if required) for your account on the remote system and press Return.
A system login message and the ftp> prompt are displayed.
Type bin to set binary format or asc to set ASCII format and press Return.
The file type is set. ASCII is the default format.
Type put local-filename destination-filename and press Return to transfer a single file.
File transfer messages and the ftp> prompt are displayed.
Type quit and press Return.
A goodbye message and the command prompt are displayed.
The following example establishes an ftp connection from the system oak to the system elm, specifies ASCII format, puts the file quest from oak into the /tmp/quest directory on elm, and quits the session.
oak% ftp
ftp> open elm
Connected to elm
220 elm FTP server (UNIX(r) System V Release 4.0) ready.
Name (elm:ignatz): ignatz
331 Password required for ignatz.
Password:
230 User ignatz logged in.
ftp> asc
ftp> put quest /tmp/quest
200 PORT command successful.
150 ASCII data connection for /tmp/quest (129.144.52.119,1333).
226 Transfer complete.
ftp> quit
221 Goodbye.
oak%
You can use the send command as an alternative to the put command. You can copy multiple files by using the mput command. There is no msend command. See the ftp(1) manual page for more information.
NOTE. You must have an account on each system to use the file transfer program.
If you have an NIS, NIS+, or LDAP account, you can use your login name and network password to access a remote system with ftp. Use the following steps to transfer files from a remote system to your local system by using the file transfer program.
Type ftp and press Return.
The ftp> prompt is displayed.
Type open remote-system-name and press Return.
System connection messages are displayed, and you are asked for a user name.
Type the user name for your account on the remote system and press Return.
If a password is required, you are asked to enter it.
Type the password (if required) for your account on the remote system and press Return.
A system login message and the ftp> prompt are displayed.
Type bin to set binary format or asc to set ASCII format and press Return.
The file type is set. ASCII is the default format.
Type get remote-filename destination-filename and press Return.
File transfer messages and the ftp> prompt are displayed.
Type quit and press Return. A goodbye message and the command prompt are displayed.
The following example establishes an ftp connection from the system oak to the system elm, specifies ASCII format, gets the file quest from elm, puts it into the /tmp/quest directory on oak, and quits the session.
oak% ftp
ftp> open elm
Connected to elm
220 elm FTP server (UNIX(r)System V Release 4.0) ready.
Name (elm:ignatz): ignatz
331 Password required for ignatz.
Password:
230 User ignatz logged in.
ftp> asc
ftp> get quest /tmp/quest
200 PORT command successful.
150 ASCII data connection for /tmp/quest (129.144.52.119,1333).
226 Transfer complete.
ftp> quit
221 Goodbye.
oak%
NOTE. You can copy multiple files by using the mget command. See the ftp (1) manual page for more information.
|