The Trivial File Transport Protocol (TFTP) proivides a mechanism to read files from or write files to a remote server. It is similar to the File Transfer Protocol (FTP), but doesn't have all of the features of FTP, such as an authentication mechanism.
The instructions below were written for the CentOS distribution of Linux,
but TFTP server software is available for Linux, Unix, Windows
and other operating systems. For Linux systems that use the Red Hat Package
Manager (RPM) package management system, you can determine if the
tftp-server package is installed with the command rpm -qi
tftp-server
.
# rpm -qi tftp-server package tftp-server is not installed
The tftp-server package depends on the xinetd package;
you can check if that package is installed with rpm
-qi xinetd
. If it isn't installed and you use the Yellow
dog Updater, Modified (YUM) package management utility,
you can install both packages with yum install tftp-server
xinetd
. To install just the tftp-server package, use yum
install tftp-server
. The installation of the tftp-server package
will create the directory /tftpboot
on the system. The
directory should be set to 755
for tftp clients to be able to
read from or write to files in the directory.
# ls -ld /tftpboot drwxr-xr-x 2 root root 4096 Dec 24 14:15 /tftpboot
You next need to turn on the tftp service with the chkconfig
command.
# chkconfig tftp on
You can verify that the service is available with chkconfig
--list tftp
.
# chkconfig --list tftp tftp on
TFTP uses the User Datagram
Protocol and listens for data on port 69, so you can also use
netstat -a | grep tftp
to check on whether the system
is listening for data on port 69. You should see something like the
following if it is listening:
udp 0 0 *:tftp *:*
If you have firewall software running on the TFTP server, you will also need to allow connectivity to UDP port 69 through the firewall. You can do this on a CentOS system through the GUI by taking the following steps:
- Click on System.
- Click on Administration.
- Select Security Level and Firewall
- Under Firewall Options, select other ports.
- Click on the Add button.
- Put
69
in the port field and selectudp
for the protocol. - Click on OK.
- Click on OK again.
- When prompted to override any existing firewall configuration, click on Yes.
To be able to write to a file on the tftp server, e.g. a file named
firewall-log.txt
in the /tftpboot
directory,
you need to first create the file with the touch
command
and then set the permissions on the file so it is "world" writable.
# touch /tftpboot/firewall-log.txt # chmod 666 /tftpboot/firewall-log.txt
Once you have the TFTP server configured, you can then transfer files from the tftp client to the server.
References:
-
TFTP Server
Date: January 8, 2007
CentOS -
Configuring a TFTP Server
Date: June 5, 2003
ONLamp.com