July 15, 2008 · Server · Email This Post

Sponsored Link
atftp is Multi-threaded TFTP server implementing all options (option extension and multicast) as specified in RFC1350, RFC2090, RFC2347, RFC2348 and RFC2349. Atftpd also supports multicast protocol known as mtftp, defined in the PXE specification. The server supports being started from inetd as well as in daemon mode using init scripts.

Install atftp Server in Ubuntu

sudo aptitude install atftpd

This will complete the installation

Using atftpd

By default atftpd server starts using inetd so we need to tell atftpd to run as a server directly, not through inetd.Edit /etc/default/atftpd file using the following command

sudo gedit /etc/default/atftpd

Change the following line

USE_INETD=true

to

USE_INETD=false

save and exit the file

Now you need to run the following command

sudo invoke-rc.d atftpd start

Configuring atftpd

First you need to create a directory where you can place the files

sudo mkdir /tftpboot

sudo chmod -R 777 /tftpboot

sudo chown -R nobody /tftpboot

sudo /etc/init.d/atftpd restart

Security configuration for atftp

Some level of security can be gained using atftp libwrap support. Adding proper entry to /etc/hosts.allow and /etc/hosts.deny will restrict access to trusted hosts. Daemon name to use in these files is in.tftpd.

/etc/hosts.allow /etc/hosts.deny

in.tftpd : FQD or IP

atftp client installation

Advance Trivial file transfer protocol client,atftp is the user interface to the Internet ATFTP (Advanced Trivial File Transfer Protocol), which allows users to transfer files to and from a remote machine. The remote host may be specified on the command line, in which case atftp uses host as the default host for future transfers.

sudo aptitude install atftp

That’s it you are ready to transfer your files using tftp clients

Testing tftp server

Tranfering file hda.txt from 192.168.1.100 (Client using tftp) to 192.168.1.2 (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 ruchi ruchi 223 hda.txt

atftp 192.168.1.2

atftp> put hda.txt

Sent 722 bytes in 0.0 seconds

atftp> quit

ls -l /tftpboot/

total 4
-rwxrwxrwx 1 ruchi ruchi 707 2008-07-07 23:07 hda.txt

Sponsored Link

Incoming search terms:

Related posts

38 Comments to “Howto Setup advanced TFTP server in Ubuntu”

  1. Alex says:

    Great job!

    Just a little mistake, maybe this command “tftp 192.168.1.2″ should be “atftp 192.168.1.2″.

    [Reply]

  2. admin says:

    @alex

    Thanks for your comment and i have updated the article

    [Reply]

  3. Ivan Ruter says:

    Very helpful – have achieved transfer from Ubuntu client to Ubuntu server (named UbuntuServer_2 with address 192.168.1.2) on in-house LAN.

    Next step is to be able to transfer from Windows XP to Ubuntu server.

    Results so far, using ‘ftp http://ftp.hostname‘ as suggested in Windows X Help:

    ftp http://ftp.UbuntuServer_2 -> Unknown host

    ftp http://ftp.192.168.1.2 -> Uknown host

    ftp 192.168.1.2 -> connected to 192.168.1.2, then after a few secs, connection closed by remote host.

    Question: any suggestions.

    Eventual aim is to be able to upload files from NuSphere phpEd (Standard) which only supports ‘passive’ FTP, installed on the Windows XP PC to the Ubuntu sever.

    [Reply]

  4. admin says:

    @Ivan Ruter

    If you want to transfer files from xp,any linux clients you can use ftp server on your ubuntu that is easy to transfer files

    [Reply]

  5. andrea mucci says:

    Hi Guys

    My Question is:

    Is possible to configure a Tftp Server for multiples domains or users.
    For example a client connet to testtftp.com the server send a response with a mail folder
    but if i connect on testtftp2.com th tfpt server send a reponse qith other folder direction

    this possible this?

    [Reply]

  6. Peter says:

    Hi admin,

    Great job!

    However I am having difficulties once it has all been installed.

    When Trying to Download a file from the server (Using tftp client on another computer), I get the following error:
    ———————-
    tftp> get config.jpg
    tftp: error received from server
    tftp: aborting
    ———————-

    AND

    When Trying to Upload a file to the server (Using tftp client on another computer) I get this error:
    ———————-
    tftp> put config.jpg
    tftp: error received from server
    ———————-

    I’ve checked the permissions of the /tftpboot folder and it has all read/write access for ALL users.

    I’ve got plenty experience with apache via port 80 and 443 (http and https) and also ftp. But i’ve never worked with tftp before and its proving to be so hard to get going.

    Am I missing something?

    Please help… I am desperate to get this going
    Any help would be greatly appreciated so thanks in advance.
    Peter

    [Reply]

  7. Robert says:

    This was most useful – thanks you! That said, I had one additional step to make on Ubuntu server 8.10:

    When editing the /etc/default/atftpd to change USE_INETD=true, I also had to amend the options line to point to the /tftpboot directory.

    My original options line read:
    OPTIONS=”–daemon –port 69 –tftpd-timeout 300 –retry-timeout 5 –mcast-port 1758 –mcast-addr 239.239.239.0-255 –mcast-ttl 1 –maxthread 100 –verbose=5 /var/lib/tftpboot”

    My Amended options line reads:
    OPTIONS=”–daemon –port 69 –tftpd-timeout 300 –retry-timeout 5 –mcast-port 1758 –mcast-addr 239.239.239.0-255 –mcast-ttl 1 –maxthread 100 –verbose=5 /tftpboot”

    [Reply]

  8. Maus says:

    Your article was very helpfull

    Still having some problems though. everthing works fine for tiny text files, but If i send anything larger (maybe 100k) it fails.

    I am trying to set this up so my PXE client can boot with thintux

    any help would be appreciated.

    almost forgot, If I run the atftp client on the server itself i dont have a problem.

    [Reply]

  9. Jcoman says:

    I think I have followed this very helpful article to the letter.

    My problem is I get the error:

    atftpd: can’t bind port :69/udp

    whenever I start atftpd

    Any suggestions?

    Thanks

    [Reply]

  10. Stephane says:

    Maybe:

    /etc/init.d/inetd restart

    and then

    /etc/init.d/atftpd start

    [Reply]

  11. Nice post, a lot of thanks!!

    [Reply]

  12. Aaron says:

    Well done!

    atftp may have moved /tftpboot directory to /var/lib/tftpboot

    look in /etc/default/atftpd

    It was this way on ubuntu 8.10.

    [Reply]

  13. Peter says:

    I’m using ubuntu server 9.04 and I get the following error when I type the command which is supposed to start the standalone service (sudo invoke-rc.d atftpd start):

    invoke-rc.d: initscript atftpd, action “start” failed.

    Any suggestions why it doesn’t start? I haven’t found any log files in /var/log… I tried setting it up using the –logfile option but it didn’t work.

    Thanks,
    Peter

    [Reply]

  14. David says:

    I am using ubuntu 9.04 desktop i386. Also getting

    invoke-rc.d: initscript atftpd, action “start” failed.

    I tried it on an x64 server and even a fresh build purely for testing this. All I changed was the “true” to “false” setting in /etc/default/atftpd file. I confirmed the permissions by chmod -R 777 /var/lib/tftpboot. No juice. This all worked fine in Intrepid 8.10.

    [Reply]

  15. David says:

    RESOLVED: failed.

    I added the “–daemon” option to /etc/default/atftpd

    This is clearly new behavior in Jaunty from Intrepid or Hardy.

    Happy–happy–joy–joy

    [Reply]

  16. Ben says:

    This was very helpful. Thanks!

    Before this worked for me…

    I changed
    –mcast-addr 239.239.239.0-255

    to
    –mcast-addr 10.5.5.0-255

    Where 10.5.5.0 is my local subnet

    [Reply]

  17. Christopher says:

    This has worked great. Many thanks.

    I do have one issue.When trying to upload a new IOS to my C7206vxr routers, I get a timed out error. It is only when uploading, and only the ios. The kboot and FPD package go fine, and I can download the ios image fine. I am sure it because of the size, but not sure how to remedy the problem. Any help would be greatly appreciated.

    Thank you

    ‘topher

    [Reply]

  18. Isama says:

    Thanx! I will try it tomorrow for backing up my cisco switch:)

    [Reply]

  19. Kcohne says:

    This solved my problem thanks much. HAPPY VERY HAPPY JOY JOY

    I am using ubuntu 9.04 desktop i386. Also getting

    invoke-rc.d: initscript atftpd, action “start” failed.

    I tried it on an x64 server and even a fresh build purely for testing this. All I changed was the “true” to “false” setting in /etc/default/atftpd file. I confirmed the permissions by chmod -R 777 /var/lib/tftpboot. No juice. This all worked fine in Intrepid 8.10.

    [Reply]

  20. krtapas says:

    Thanks a lot for this information and for Robert too, because with his tips, I’d configure a TFTP server for my Polycom Soundpoint, because I couldn’t with vsftpd.

    [Reply]

  21. ortang says:

    Thanks to this article and your comments i was finally able to get it work on 9.04 (x64)

    my changes:

    in /etc/default/atftpd:
    * USE_INETD=false
    OPTIONS:
    * added –daemon
    * changed –mcast-addr to fit my enviroment

    modified /var/lib/tftpboot (chmod 777, chown nobody)

    /etc/init.d/openbsd-inetd restart
    /etc/init.d/atftpd start

    thanks, ortwin

    [Reply]

  22. Xyverz says:

    ortang – that worked like a charm. Thanks!

    [Reply]

  23. Mikesch says:

    Just for info, there is no need to change the mcast addr option to your network, since mcast addresses have their own range!
    http://en.wikipedia.org/wiki/Multicast_address

    [Reply]

  24. NewtownGal says:

    RE: writing to a subfolder

    How do I write to a subfolder of /tftpboot ? I keep getting an access violation. I can write just fine to /tftpboot from another machine, so I know the basic setup is working. I made a subfolder and gave it the same mode and group as the parent.

    I’m using the following command to try to write:

    tftp IPaddress -c put filename /folder/

    I’ve tried lots of variations with the folder specification but no luck writing to it. The docs say one can specify a folder.

    Thank you.

    – NewtownGal

    [Reply]

  25. tapas mishra says:

    Ok as some one above pointed out in options they had to put /var/lib/tftp line similarly I had to put one more line in /etc/inted.conf
    tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

    [Reply]

  26. tapas mishra says:

    I have mentioned my configuration here some one coming here should read this if something does not work for them
    http://mightydreams.blogspot.com/2010/05/pxe-boot-installation-for-ubuntu.html

    [Reply]

  27. psypher246 says:

    HI all,

    ATFTPD is a really stupid limitation of only allowing files smaller that 32MB to be transferred. I found this out when trying to copy Cisco IOS images. Rather install tftpd with xinetd as this does not have that limitation.

    Howto:
    http://www.davidsudjiman.info/2006/03/27/installing-and-setting-tftpd-in-ubuntu/

    Just as simple as the instructions for atftpd

    [Reply]

  28. Great!It is very useful!I will try to install it and share with my friends!Thx

    [Reply]

  29. hackatwrs says:

    It seems many of you had an issue allowing writes to your /tftpboot directory. You need to add “-c” to your server args in /etc/xinetd.d/tftp

    service tftp
    {
    socket_type = dgram
    protocol = udp
    wait = yes
    user = root
    server = /usr/sbin/in.tftpd
    server_args = -s -c /tftpboot
    flags = IPv6 IPv4
    }

    Hope this helps…

    [Reply]

  30. Hertz says:

    Just managed to get atftp to work on ubuntu 11.04 (64 bit) after some effort. Here is what I have done:

    - Followed the instructions
    at the top of this page

    - edit atftpd configuration: sudo nano /etc/default/atftpd

    USE_INETD=false
    OPTIONS=”–tftpd-timeout 300 –retry-timeout 5 –mcast-port 1758 –mcast-addr 255.255.255.0-255 –mcast-ttl 1 –maxthread 100 –verbose=5 –daemon /tftpboot”

    (my files are in /tftpboot)

    /etc/init.d/atftpd start

    sudo atftp
    put myfile

    [Reply]

Leave a Reply