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 192.168.1.100 (Client using tftp) to 192.168.1.100 (Server 192.168.1.100). 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 192.168.1.100 
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

179 thoughts on “Installing and setting TFTPD in Ubuntu

  1. Kosta Zertsekel

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

  2. brian

    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. Pingback: Ubuntu: What I do after install « Binary Delusions

  4. Pingback: Unix useful tips « Container

  5. floorripper

    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

  6. Pingback: Ubuntu 11.10: What I do after Install « Binary Delusions

  7. zidarsk8

    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
    hello

    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 :P

  8. Stefano

    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”.

  9. bjforesthowell@gmail.com

    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/xinetd.pid -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
    USE_INETD=true
    OPTIONS=”–tftpd-timeout 300 –retry-timeout 5 –mcast-port 1758 –mcast-addr 239.239.239.0-255 –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
    root@Thunder-Dong:/home/bhowell/Downloads#

    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?

  10. bjforesthowell@gmail.com

    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.

  11. Janos Molnar

    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 (http://packages.ubuntu.com/hardy/i386/tftpd/download) of tftpd and copy the in.tftpd file from the .deb package to /usr/sbin/ on Ubuntu 10.04.

  12. Steve

    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 ?

  13. Pingback: how to use TFTP ( Trivial File Transfer Protocol )?

  14. sas3

    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?

    Thanks,
    Shastri

  15. Gabriel

    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://172.16.2.138/ASA-runn (Access violation)

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

  16. Pingback: Tftp installation | Charlestonslip

  17. rodyz

    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

  18. LG

    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’

  19. Pingback: Instalar un servidor tftp en Ubuntu 12.04 « MACTIZE.ES

  20. Adam

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

  21. Pingback: Installing and setting TFTPD in Ubuntu | Embedded System

  22. Pingback: Build and boot Linux (over network) | Prajosh Premdas

  23. Pingback: Setup HTTPS SSL access on a Netgear GS724T switch | Snarly Sod Boxer's blog

Leave a Reply