You are on page 1of 5

System User's Guide: Communications

and Networks

Transferring Files
Although it is possible to send relatively short files using electronic mail, there are more
efficient ways of transferring large files. Electronic mail programs are usually designed to
transmit relatively small amounts of text; therefore, other means are needed to transfer
large files effectively. The ftp, rcp, and tftp commands rely on TCP/IP to establish direct
connections from your local host to a remote host. Basic Network Utilities (BNU) can
also use TCP/IP to provide direct connections with foreign hosts.

• Copying Files Using the ftp and rcp Commands


• Copying files using the tftp and utftp commands (Copying Files Using the tftp
and utftp Command)

Copying Files Using the ftp and rcp Commands

The ftp command allows you to copy a file from a remote host. It does not preserve file
attributes or copy subdirectories. If either of these conditions are necessary, use the rcp
command.

ftp Uses the File Transfer Protocol (FTP) to transfer files between hosts that use
different file systems or character representations, such as EBCDIC and ASCII. It
provides for security by sending passwords to the remote host and also permits
automatic login, file transfers, and logoff.
rcp Copies one or more files between a local host and a remote host, between two
separate remote hosts, or between files at the same remote host. This command is
similar to the cp command except that it works only for remote file operations. If
extra security is needed for your network, this command is disabled by the system
manager.

Prerequisites

1. You must have remote login permission specified in the remote host's
$HOME/.netrc file if the automatic login feature is to be used. Otherwise, you
must know a login name and password for the remote host. For more information
about the .netrc file, refer to Creating the .netrc File.

Alternatively, the system can be configured to use Kerberos V.5 authentication.


This is used instead of the .netrc or $HOME/.rhosts files. More information
about this can be found in the section on Understanding the Secure Rcmds.
2. If you wish to copy a file from a remote host, you must have read permission for
that file.

Note: The read and write permissions for files and directories on a remote host
are determined by the login name used.

3. If you wish to copy a file from your local host to a remote host, you must have
write permission for the directory that is to contain the copied file. Also, if the
directory on the remote host contains a file with the same name as the file that you
wish to place in it, you must have write permission to append the file on the
remote host.

To Log in to a Remote Host

1. Use the cd command to change to the directory that contains the file you want to
send (sending a file) or to the directory where you want the transferred file to
reside (receiving a file).
2. Log in to the remote host. This can be done either directly or indirectly. To log in
to a remote host directly, type:
3. ftp HostName

If you have automatic login permission, information similar to the following


appears on your local host:

Connected to canopus.austin.century.com.
220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23
12:52:09 CST 1995) ready.
331 Password required for dee.
230 User dee logged in.
ftp>

Otherwise, information similar to the following displays on your local host. Type
your login name and password when prompted by the system.

Connected to canopus.austin.century.com.
220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23
12:52:09 CST 1995) ready.
Name (canopus:eric): dee
331 Password required for dee.
Password:
230 User dee logged in.
ftp>

4. To log in to a remote host indirectly, type:


5. ftp

When the ftp> prompt is displayed, type:

open HostName
If you have automatic login permission, the following information appears on
your local host:

Connected to canopus.austin.century.com.
220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23
12:52:09 CST 1995) ready.
331 Password required for dee.
230 User dee logged in.
ftp>

Otherwise, information similar to the following displays on your local host. Type
your name and password when prompted by the system.

Connected to canopus.austin.century.com.
220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23
12:52:09 CST 1995) ready.
Name (canopus:eric): dee
331 Password required for dee.
Password:
230 User dee logged in.
ftp>

You are now ready to copy a file between two hosts.

To Copy a File from a Remote Host to a Local Host

The ftp command uses the ASCII default transfer type to copy files.

1. Determine if the file that you wish to copy is in the current directory by issuing
the dir subcommand. (The dir subcommand for the ftp command functions the
same as the ls -l command.) If the file is not there, use the cd subcommand to
move to the proper directory.
2. If you wish to copy your local file using binary image, type:
3. binary
4. To copy a file to your host, type:
5. get FileName

The file is placed in the directory from which you issued the ftp command.

6. To end the session, press the Ctrl-D key sequence or type quit.

To Copy a File from a Local Host to a Remote Host

The ftp command uses the ASCII default transfer type to copy files.

1. If you wish to place the file in a directory other than the $HOME directory, use
the cd subcommand to move to the desired directory.
2. If you wish to copy your local file using binary image, type:
3. binary
4. o copy a file to the remote host, type:
5. put FileName

The file is placed in the working directory of the remote host.

6. To end the session, press the Ctrl-D key sequence or type quit.

Copying Files Using the tftp and utftp Command

The tftp and utftp commands use the Trivial File Transfer Protocol (TFTP) to transfer
files to and from hosts. Because TFTP is a single-file transfer protocol, the tftp and utftp
commands do not provide all the features of the ftp command. If extra security is
required for your network, the system manager can disable this command.

Note: The tftp command is not available when your host is operating at a high level of
security.

Prerequisites

1. If you wish to copy a file from a remote host, you must have read permission for
the directory that contains the desired file.
2. If you wish to copy a file to a remote host, you must have write permission for the
directory in which the file is to be placed.

To Copy a File from a Remote Host

1. To establish a connection to a remote host, type:


2. tftp host1

In this example, host1 is the name of the host to which you wish to connect.

3. The tftp> prompt is displayed. To determine that a connection has been


established, type:
4. status

A message similar to the following appears:

Connected to host1
Mode: netascii Verbose: off Tracing: off
Remxt-interval: 5 seconds, Max-timeout: 25 seconds
tftp>

5. After the tftp> prompt, type the get subcommand, the name of the file to be
transferred, and the name to be assigned to the file on the remote system:
6. get /home/alice/update update
The /home/alice directory on the remote host must have read permission set for
others. In this example, the /home/alice/update file is transferred from host1 to
the update file in the current directory on the local system.

7. To end the session, type:


8. quit

or use the Ctrl-D key sequence.

To Copy a File to a Remote Host

1. To establish a connection to a remote host, type:


2. tftp host1

In this example, host1 is the name of the host to which you wish to connect.

3. The tftp> prompt is displayed. To determine that a connection has been


established, type:
4. status

A message similar to the following appears:

Connected to host1
Mode: netascii Verbose: off Tracing: off
Remxt-interval: 5 seconds, Max-timeout: 25 seconds
tftp>

5. After the tftp> prompt, type the put subcommand, the name of the file to be
transferred from the local host, and the path and file name for the file on the
remote host:
6. put myfile /home/alice/yourfile

The /home/alice directory on the remote host must have write permission set for
others. The myfile file, located in the user's current working directory, is
transferred to host1. The path name must be specified unless a default has been
established. The myfile file appears on the remote host as yourfile.

7. To end the session, type:


8. quit

or use the Ctrl-D key sequence.

You might also like