How to install tftp server in Ubuntu

In order to install a tftp server on Ubuntu, you have to download and install following packages:

  1. xinetd
  2. tftpd
  3. tftp

Open a terminal window and type following command:

$ sudo apt-get install xinetd tftpd tftp

This will install tftp server in your system. Now we have to make some changes in order to use tftfp server.

Create /etc/xinetd.d/tftp by giving the following command in terminal:

$ sudo gedit /etc/xinetd.d/tftp

This will open a file in gedit text editor, write following lines in this file:

service tftp

{

protocol = udp

port = 69

socket_type = dgram

wait = yes

user = nobody

server = /usr/sbin/in.tftpd

server_args = /tftpboot

disable = no

}

We defined server_args= /tftpboot. You can give any other name you want. I am taking “/tftpboot” as default as many systems take it. Now we have to create a directory with the name we defined in “server_args”. Give following command in the terminal:

$ sudo mkdir /tftpboot

Now change read/write permissions and owner of the directory to “nobody” by giving following commands:

$ sudo chmod -R 777 /tftpboot

$ sudo chown -R nobody /tftpboot

We will now restart the xinetd service.

$ sudo /etc/init.d/xinetd restart

tftp Server is up and running. We should test now whether it’s working or not.
Create a file say “tftptest” , add some content in this file and put it in the directory “/tftpboot”.
Also chnage the permission of the file.

$ sudo chmod 777 /tftpboot/tftptest

You can also chage the permissions of all the files and folders located in “/tftpboot” directory by following command:

$ sudo chmod -R 777 /tftpboot

Now you shold find out ip address of your system. Use “ifconfig” command or right click on network manager applet > Connection Information to obtain ip-address of your system.

$ ifconfig

Let’s we get ip-address as 10.10.0.3

Now open terminal window on another system(should be in same network and tftp client installed in it.)

Give following commands:

$ tftp 10.10.0.3

tftp> get tftptest

tftp> quit

$ less tftptest

Check the content of this file. If matches with what you put in your server’s file, that’s it. Congratulations ..!!! You got your tftp server working. 🙂

Related posts

Leave a comment....