jump to navigation

Setup TFTP Server on CentOS February 22, 2011

Posted by Tournas Dimitrios in Linux.

While upgrading the firmware on several network devices this past weekend, I needed to bring up a tftp server so the clients could retrieve the firmware image. I had a CentO 5.x host readily available, so getting tftp up and working was super easy. Before configuring the server, let’s first introduce some fundamental concepts to networking . Probably newcomers will not distinguish  the differences between Ftp and Tftp . From a practical perspective both protocols are similar , they  transfer files bidirectional , between two remote computers . From a technical perspective they utilised it with a totally different method .

TFTP’s main difference from FTP is the transport protocol it uses and the lack of any authentication mechanisim. Where FTP uses the robust TCP protocol to establish connections and complete the file transfers, TFTP uses the UDP protocol which is unsecure and has no error checking built in to it (unless they have implemented some type of error checking in the program you are using to transfer files), this also explains why you are more likely to find TFTP in a LAN, rather than a WAN (Wide Area Network) or on the Internet.

The major limitations with TFTP are authentication and directory visibility, meaning you don’t get to see the files and directories available at the TFTP server.As mentioned, TFTP uses UDP as a transport, as opposed to TCP which FTP uses, and works on port 69 . Port 69 is the default port for TFTP, but if you like, you can modify the settings on your TFTP server so it runs on a different port.

Another fundamental concept I would like to introduce is the xinetd (super-server) , because Tftp is based on xinetd . Many network enabled Linux applications don’t rely on themselves to provide restricted access or bind to a particular TCP/UDP port; instead they often offload a lot of this work to a program suite made just for this purpose, xinetd.The xinetd deamon is installed by default on RedHat based Linux distributions and uses /etc/xinetd.conf as its main configuration file. Fortunately you usually don’t have to edit this file so that day to day xinetd operation is frequently limited to only starting and stopping xinetd managed applications like : chkconfig  tftp  on

That was all the theory , now lets install and configure tftp :

  • Install TFTP Server: Use the below syntax to install the TFTP server on CentOS.
    yum  install  tftp-server
  • Install Xinetd: The TFTP server will run via xinetd so you need to make sure xinetd is installed using the bellow command.
    yum  install xinetd
  • Enable TFTP and Xinetd: Use chkconfig to ensure that xinetd and tftp starts on reboot.
    chkconfig  tftp  on
    chkconfig  xinetd on
    service  xinetd  start
  • Modify TFTPBOOT Permissions: Use the below syntax to modify the permissions of the /tftpboot directory to allow tftp transfers to and from this directory. The /tftpboot directory is the default directory where files are transfered to and from using TFTP.
    chmod  777  /tftpboot
  • Install a Tftp client on the remote host
    yum  install  tftp
  • Example TFTP Command: The below is an example of use of the TFTP command.
    tftp  -v  -c  put file-example.txt
    tftp  -v  -c  get file-example.txt

The tftp configuation file :

Usualy there is no need to configure this file , but in case … , this is an example :

cat /etc/xinetd.d/tftp
service tftp
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4

Of course after each modification on this file , the super server xinetd must be restarted :
service  xinetd  restart

The normal computer user is probably not going to find TFTP very useful but techies will be able to find many uses. Typically technical people will run across TFTP when upgrading the firmware on some sort of network device (cisco routers ) .




1. nombre (required) - December 22, 2011

nice post…perfectly explained.

2. abc@wordpress.com - November 1, 2012

Small addendum for Centos 6.3:
if you cannot upload (new) files to your tftp-server and experience the following error:

Connected to (, port 69
putting test to [netascii]
Error code 1: File not found

add the “-c” parameter to your config (@see “man in.tftpd”):

server_args = -c -s /var/lib/tftpboot

see also:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s