[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 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 Transmission Control Protocol/Internet Protocol (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

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. 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, enter:
    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. Enter 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>
  3. To log in to a remote host indirectly, enter:
    ftp
    When the ftp> prompt is displayed, enter:
    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. Enter 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, enter:
    binary
  3. To copy a file to your host, enter:
    get FileName
    The file will be placed in the directory from which you issued the ftp command.

  4. To end the session, press the Ctrl-D key sequence or enter 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, enter:
    binary
  3. To copy a file to the remote host, enter:
    put FileName

    The file will be placed in the working directory of the remote host.

  4. To end the session, press the Ctrl-D key sequence or enter 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. Since 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, enter:
    tftp host1
    In this example, host1 is the name of the host to which you wish to connect.

  2. The tftp> prompt is displayed. To determine that a connection has been established, enter:
    status
    A message similar to the following will appear:
    Connected to host1
    Mode: netascii Verbose: off Tracing: off
    Remxt-interval: 5 seconds, Max-timeout: 25 seconds
    tftp>
  3. After the tftp> prompt, enter the get subcommand, the name of the file to be transferred, and the name to be assigned to the file on the remote system:
    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.

  4. To end the session, enter:
    quit
    OR

    the Ctrl-D key sequence.

To Copy a File to a Remote Host

  1. To establish a connection to a remote host, enter:
    tftp host1
    In this example, host1 is the name of the host to which you wish to connect.

  2. The tftp> prompt is displayed. To determine that a connection has been established, enter:
    status
    A message similar to the following will appear:
    Connected to host1
    Mode: netascii Verbose: off Tracing: off
    Remxt-interval: 5 seconds, Max-timeout: 25 seconds
    tftp>
  3. After the tftp> prompt, enter 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:
    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 .

  4. To end the session, enter:
    quit
    OR

    the Ctrl-D key sequence.

Related Information

The tftp command.

The tftpd daemon.

The cd command, ls command, ftp command, rcp command.

The ftpd daemon.


[ Previous | Next | Contents | Glossary | Home | Search ]