Install Configure and Test TFTP Server in Ubuntu

Install tftpd and related packages in server system

$ sudo apt-get install xinetd tftpd tftp

Create a file named tftp in /etc/xinetd.d/

$sudo touch /etc/xinetd.d/tftp

Edit this file

$sudo vim /etc/xinetd.d/tftp

Enter the following content to that file

service tftp
{
protocol        = udp
port            = 69
socket_type     = dgram
wait            = yes
user            = nobody
server          = /usr/sbin/in.tftpd
server_args     = /tftpboot
disable         = no
}

Create a folder /tftpboot  this should match whatever you gave in server_args. mostly it will be tftpboot

$ sudo mkdir /tftpboot
$ sudo chmod -R 777 /tftpboot
$ sudo chown -R nobody /tftpboot

Start tftpd through xinetd

$ sudo /etc/init.d/xinetd stop
$ sudo /etc/init.d/xinetd start

Now tftp server is up and running

Testing the tftp server

Create a file named hello.txt with some content in /tftpboot path of the tftp server

ls -l /tftpboot/
total 4
-rw-rw-r-- 1 ganesh ganesh 0 Sep 4 12:38 hello.txt

Install tfp in a client machine

$ sudo apt-get install  tftp

Obtain the ip address of the tftp server using ifconfig command, in this example we will consider the ip address as 192.168.1.2

Now in client system

$ tftp 192.168.1.2
tftp> get hello.txt
Sent 159 bytes in 0.0 seconds
tftp> quit
Happy Hacking 🙂

Advertisements