Installing and setting TFTPD in Ubuntu

1. Install tftpd and related packages.

$ sudo apt-get install xinetd tftpd tftp

2. Create /etc/xinetd.d/tftp and put this entry:

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

3. Make /tftpboot directory

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

4. Start tftpd through xinetd

$ sudo /etc/init.d/xinetd start

5. Testing. Tranfering file hda.txt from (Client using tftp) to (Server Get an example file to transfer (eg. hda.txt)

$ touch /tftpboot/hda.txt
$ chmod 777 /tftpboot/hda.txt
$ ls -l /tftpboot/
total 0
-rwxrwxrwx  1 davids davids 0 2006-03-27 23:04 hda.txt
$ tftp 
tftp> put hda.txt
Sent 722 bytes in 0.0 seconds
tftp> quit
$ ls -l /tftpboot/
total 4
-rwxrwxrwx  1 davids davids 707 2006-03-27 23:07 hda.txt

182 Replies to “Installing and setting TFTPD in Ubuntu”

  1. Works clean on fresh installation of Ubuntu 11.04 64-bit on Intel machine!
    Thanks a lot. — Kosta

  2. had mega problems with this.
    finally tracked down to the problem the folder required
    /var/lib/tftpboot and not just /tftpboot

    why does the ‘/var/lib’ need to be specified

    am using Ubuntu

    cheers Brian

  3. when you have issues with the daemon you can use:

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

    config of the file */etc/xinetd.d/tftp * should be:
    service tftp
    protocol = udp
    port = 69
    socket_type = dgram
    wait = yes
    user = nobody
    server = /usr/sbin/in.tftpd
    server_args = var/lib//tftpboot
    disable = no

    I am on Ubuntu 10.04

  4. Hi, when i perform the
    >get test
    all i get is an empty test file in the directory, but i do have this
    ~$ cat /tftpboot/test

    any suggestions, i need to upload a new kernel to my arm device, and the only thing that’s giving me problems is the tftp server. Kinda sad 😛

  5. I get

    $ start xinetd
    start: Rejected send message, 1 matched rules; type=”method_call”, sender=”:1.193″ (uid=1000 pid=4197 comm=”start xinetd “) interface=”com.ubuntu.Upstart0_6.Job” member=”Start” error name=”(unset)” requested_reply=”0″ destination=”com.ubuntu.Upstart” (uid=0 pid=1 comm=”/sbin/init”)

    when I try to start the server (it also happens with “service xinetd start”). The server doesn’t start and when I try to get/put some file, I get “connection timeout”.

  6. I’m trying to get this working using a directory in my Downloads folder using a different user name, and I’m not coming up with anything… Here’s what I’ve got so far…

    tftp, and atftpd aren’t running, xinetd seems to be running fine.

    root@Thunder-Dong:/home/bhowell# ps -ef | grep tftp
    root 2572 2560 0 15:59 pts/1 00:00:00 grep tftp
    root@Thunder-Dong:/home/bhowell# ps -ef | grep atftpd
    root 2574 2560 0 16:00 pts/1 00:00:00 grep atftpd
    root@Thunder-Dong:/home/bhowell# ps -ef | grep xinetd
    root 1058 1 0 15:51 ? 00:00:00 /usr/sbin/xinetd -dontfork -pidfile /var/run/ -stayalive -inetd_compat -inetd_ipv6
    root 2576 2560 0 16:00 pts/1 00:00:00 grep xinetd

    root@Thunder-Dong:/home/bhowell# cat /etc/xinetd.d/tftp
    protocol = udp
    port = 69
    socket_type = dgram
    wait = yes
    user = bhowell
    server = /usr/sbin/in.tftpd
    server_args = /home/bhowell/Downloads/TFTP
    disable = no

    root@Thunder-Dong:/home/bhowell# cat /etc/default/atftpd
    OPTIONS=”–tftpd-timeout 300 –retry-timeout 5 –mcast-port 1758 –mcast-addr –mcast-ttl 1 –maxthread 100 –verbose=5 /home/bhowell/Downloads/TFTP”

    root@Thunder-Dong:/home/bhowell/Downloads# ls -al | grep TFTP
    drwxrwxr-x 2 bhowell bhowell 4096 2011-11-02 14:41 TFTP

    I found another site explaining how to set up atftpd, but the only thing it says to do is to set the INETD field to false. And to change the ownership of the file you’re copying from to nobody. Does the user field really matter?

  7. Update….

    I was able to put a file from the client (Cisco 3750) into the directory that I had created, now I having problems copying files from that directory into the switch.

  8. Access violation error comes because you can put a file in /tftpboot with tftp client if that file is already exists with 777 permissions. I think this is a bullshit security regulation. I think most administrators uses tftp to save the configuration of the switches and routers. In this case iptables can create the proper security environment. But I am not a IT security man, just an administrator who have sucked a day with this Access violation.

    To solve this problem I have downloaded the previous version ( of tftpd and copy the in.tftpd file from the .deb package to /usr/sbin/ on Ubuntu 10.04.

  9. When you say: ‘ Create /etc/xinetd.d/tftp and put this entry:’ do you mean to edit the tftp file to include the text you posted ? The tftp fle on my system is ‘read only’…do I need to chmod and then vi the file to include the text posted ?

  10. Is there any way to get a verbose logging of the tftp transactions? Example, IP address of user / host fetching a file from the tftp server?


  11. Janos Molnar on January 25, 2012 at 12:27 am !

    Yes! after seeking in a lot of pages, you were right. I couldn’t solve this

    Destination filename [running-config]? ASA-runn
    Cryptochecksum: 1d9d8f98 9d8883d7 3d0ca284 737eb3f0
    %Error writing tftp:// (Access violation)

    but i installed the previous version and it works ok!!!

  12. like brian on August 31, 2011 it worked only for me with
    server_args = var/lib//tftpboot in /etc/inetd.d/tftp
    and creating directory /var/lib/tftp

    using Backtrack v5.2

  13. Worked fine for me in 12.04. — though I did have issues when running as a vmware guest — fixed by switching to virtualbox 🙂

    Make sure to put the file in there in /etc/xinetd.d/ as the package does not do it for you.

    The new way to restart xinetd is ‘sudo service xinetd restart’

  14. xinetd is not used anymore after upgrading newer ubuntu 12.10 or linux mint14. now TFTP does not work anymore.

Leave a Reply