How to install TFTP server on Ubuntu

What is TFTP?

Tftpd is a server which supports the Internet Trivial File Transfer Protocol (RFC 783). The TFTP server operates at the port indicated in the `tftp’ service description and the server is normally started by inetd or the latest xinetd.

The trivial file transfer protocol (TFTP) is a UDP-based file transfer program that is frequently used to allow diskless hosts to boot over the network. TFTP is implemented by the tftp client program and the tftpd server program. Because TFTP has no user authentication, it may be possible for unwanted file transfer to occur. It is a significant threat that tftp may be used to steal password files.

System Requirements

The following software packages is required to run TFTP server.

  • DHCP Server

Steps to install

Become a super user

user@server:~# sudo su -
 Password:

Install the necessary packages

root@server:~# apt-get install xinetd tftpd-hpa

Next, configure xinetd to run TFTP and allow remote connections. By default TFTP won’t be started by xinetd, so edit /etc/xinetd.d/tftp and replace disable=yes with disable=no. If the file is missing, just create /etc/xinetd.d/tftp with the contents below.

service tftp
 {
 disable = no
 socket_type = dgram
 protocol = udp
 wait = yes
 user = root
 server = /usr/sbin/in.tftpd
 server_args = -s /var/tftpboot
 }

Restart the xinetd to make the changes take effect

root@server:~# /etc/init.d/xinetd restart

You can check whether the tftpd server in running or not by the following command

root@server:~# netstat -uap
 Active Internet connections (servers and established)
 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
 udp 0 0 *:tftp

Configure the DHCP server

Edit the DHCP configuration file and add the following lines into respective section.

root@server:~# vim /etc/dhcp3/dhcpd.conf
#LTSP Path Options
 option root-path "192.168.0.112:/opt/ltsp-4.1/i386";
 filename "/lts/vmlinuz-2.4.26-ltsp-2";
#Address of the tftp server to download the ltsp file from)
 next-server 192.168.0.254;

Restart the DHCP server

root@server:~# /etc/init.d/dhcpd-server restart