Transfers files between hosts using the Trivial File Transfer Protocol (TFTP).
{tftp | utftp} { -g | -o | -p | -r | -w } LocalName HostPort RemoteName [ netascii | image]
The /usr/bin/tftp and utftp commands transfer files between hosts using the Trivial File Transfer Protocol (TFTP). Since TFTP is a minimal file transfer protocol, the tftp and utftp commands do not provide all of the features of the ftp command. For example, the tftp and utftp commands do not provide the ability to list remote files or change directories at the remote host, and only limited file access privileges are given to the remote TFTP server. The utftp command is a form of the tftp command for use in a pipe.
The remote host must have a tftpd daemon started by its inetd daemon and have an account defined that limits the access of the tftpd daemon. Use the procedure defined by the tftpd command to setup the TFTP environment and the nobody account.
Note: The tftp and utftp commands should not be available when your host is operating in secure mode.
The tftp command ignores duplicate acknowledgments for any block sent and sends an error packet and exit if a block with an inappropriate (future) block number arrives. It also ignores duplicate data blocks if they have already been received and sends an error packet and exits.
The user can pick the maximum time-out value, but the initial time-out value for the first block is hardcoded. The user cannot pick the maximum time-out value for the server; the server times out after six retries with a maximum time-out value of 64 seconds.
The /etc/tftpaccess.ctl file is searched for lines that start with allow: or deny:. Other lines are ignored. If the file doesn't exist, access is allowed. The allowed directories and files can be accessed and the denied directories cannot be accessed. For example, the /usr directory might be allowed and the /usr/ucb directory might be denied. This means that any directory or file in the /usr directory, except the /usr/ucb directory, can be accessed. The entries in the /etc/tftpaccess.ctl file must be absolute path names.
The /etc/tftpaccess.ctl file should be write-only by the root user and readable by all groups and others (that is, owned by root with permissions of 644). The user nobody must be able to read the /etc/tftpaccess.ctl file. Otherwise, the tftpd daemon is not able to recognize the existence of the file and allows access to the entire system. For more information, refer to the sample tftpaccess.ctl file, which resides in the /usr/samples/tcpip directory.
The search algorithm assumes that the local path name used in the tftp command is an absolute path name. It searches the /etc/tftpaccess.ctl file looking for allow:/. It repeatedly searches for allowed path names with each partial path name constructed by adding the next component from the file path name. The longest path name matched is the one allowed. It then does the same with denied names, starting with the longest allowed path name matched.
For example, if the file path name were /a/b/c and the /etc/tftpaccess.ctl file contained allow:/a/b and deny:/a, one allowed match would be made (/a/b) and no denied match starting with /a/b would be made, and access would be allowed.
If the /etc/tftpaccess.ctl file contained allow:/a and deny:/a/b, one allowed match would be made (/a) and one denied match starting with /a (/a/b) would be made, and access would be denied. If the /etc/tftpaccess.ctl file contained allow:/a/b and also contained deny:/a/b, access would be denied because allowed names are searched first.
Note: Further information and example configurations for Xstations, Diskless clients, and restricted entry can be found in the /usr/samples/tcpip/tftpaccess.ctl file.
The tftp and utftp commands have two forms: interactive form and command-line form.
In the interactive form, the tftp and utftp commands are issued alone or with a Host parameter that specifies the default host to use for file transfers during this session. If you choose, you can also specify with the Port parameter which port the tftp or utftp connection should use, such as the one specified for mail in the /etc/services file. When you enter the interactive form of either of these commands, the tftp> prompt is displayed.
When transferring data to a remote host, the transferred data is placed in the directory specified by the RemoteName parameter. The remote name must be a fully specified file name, and the remote file must both exist and have write permission set for others. The tftp command attempts to write the data to the specified file. However, if the remote TFTP server does not have the appropriate privileges to write the remote file or if the file does not already exist, the transfer is unsuccessful. This can be overridden using the tftpd daemon.
The command-line forms of the tftp and utftp commands are equivalent, except that the utftp command does not overwrite a local file. The tftp command can overwrite a file, but prompts the user before doing so. Because it is not interactive, the command line form of the utftp command can be more useful than the tftp command in a pipe. In the command line form, all of the arguments to either command are specified on the command line, and no prompt is displayed.
The tftp and utftp subcommands can be entered in either their interactive form or in their command-line form.
Once the tftp> prompt is displayed, the following subcommands can be issued:
? [Subcommand] | Displays help information. If a Subcommand parameter is specified, only information about that subcommand is displayed. |
ascii | Synonym for the mode ascii subcommand. |
binary | Synonym for the mode binary subcommand. This subcommand is used in the interactive mode. The image subcommand accomplishes the same thing as the mode binary subcommand, but is used on the command line. |
connect Host [Port] | Sets the remote host, and optionally the port, for file transfers. Since the TFTP protocol does not maintain connections between transfers, the connect subcommand does not create a connection to the specified host, but stores it for transfer operations. Because the remote host can be specified as part of the get or put subcommand, which overrides any host previously specified, the connect subcommand is not required. |
get RemoteFile [LocalFile]
put LocalFile [RemoteFile]
put LocalFile LocalFile LocalFile [LocalFile . . . ] RemoteDirectory | |
Puts a file or set of files from the local host onto the remote host.
The RemoteDirectory and RemoteFile parameters can be specified in one of the following two ways:
In either case, the remote file or directory name must be a fully specified path name, even if the local and remote directories have the same name. If a remote directory is specified, the remote host is assumed to be a UNIX machine. The default value of the put subcommand is write-replace, but you can add an option in the tftpd daemon to allow write-create. |
|
quit | Exits the tftp session. An End-Of-File key sequence also exits the program. |
status | Shows the current status of the tftp program, including, for example, the current transfer mode (ascii or binary), connection status, and time-out value. |
timeout Value | Sets the total transmission time out to the number of seconds specified by the Value parameter. |
trace | Turns packet tracing on or off. |
verbose | Turns verbose mode, which displays additional information during file transfer, on or off. |
In this form, if the Action flag is:
For both of the following modes of file transfer, the RemoteName parameter is the name of a file that has write permission set for others. Note that the RemoteName parameter must be in double quotes (" ") if it contains shell special characters.
The mode of transfer is one of the following:
The following examples distinguish the differences between the interactive form and the command line form of the tftp command:
To enter the tftp command, check the current status, connect to a remote host, and transfer a file from a remote host to your local host, enter:
tftp
The tftp> prompt is displayed. Enter the status subcommand following this prompt:
A message similar to the following is displayed on your screen:
Not connected. Mode: netascii Verbose: off Tracing: off Max-timeout: 25 seconds tftp> _
After the tftp> prompt, enter the connect subcommand and the name of the remote system to which you want to connect:
The tftp> prompt is displayed as an indication that you are connected to host1. Following the tftp> prompt, enter the get subcommand to transfer the file update from the remote host to your local host.
The /home/alice directory on the remote host must have read permission set for others. The /home/alice/update file from host1 was transferred to the update file on your local system. In this example, the user is connected to host1 and the update file is transferred from host1 to the local host.
192.100.13.3 nameserver 192.100.13.3 host2 192.100.13.5 host1 192.100.13.7 host3 192.100.13.3 timeserver Received 128 bytes in 0.4 seconds $ _
In this example, the /etc/hosts file from remote host host3 was copied and the output redirected to standard output of the local host.
Sent 94146 bytes in 6.7 seconds
In this example, the /home/jeanne/test file was sent to the /tmp directory on the remote host host2.
Sent 309295 bytes in 15 seconds
In this example, the binary file core from the current directory was sent to the /tmp directory on remote host host3.
/etc/tftpaccess.ctl | Allows or denies access to files and directories. |
The ftp command, grep command, rcp command.
The ftpd daemon, inetd daemon, tftpd daemon, syslogd daemon.
The hosts file format, services file format.
Copying Files Using the tftp Command in AIX 5L Version 5.2 System User's Guide: Communications and Networks.
Network Overview in AIX 5L Version 5.2 System User's Guide: Communications and Networks.