Installing and Testing TFTP Server in Ubuntu/Debian


Installing and Testing TFTPD Server in Ubuntu

1. Install following 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. 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
4. Restart the xinetd service.
$ sudo /etc/init.d/xinetd stop
$ sudo /etc/init.d/xinetd start
Now our tftp server is up and running.

Testing our tftp server

5. Create a file named test with some content in /tftpboot path of the tftp server
$ ls / > /tftpboot/test
$ sudo chmod -R 777 /tftpboot
$ ls /tftpboot/test -lh
-rw-r--r-- 1 thalib thalib 159 2010-03-05 20:48 test
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
6. Now in some other system follow the following steps.
$ tftp 192.168.1.2
tftp> get test
Sent 159 bytes in 0.0 seconds
tftp> quit
$ ls test -lh
-rw-r--r-- 1 thalib thalib 159 2010-03-05 20:48 test

Thats it. Our tftp server is working fine.

About these ads

39 Comments

  1. Assalamualaikum..i am new with the tftp and i need to finish up this project by the end of this month..i really need someone to help me with this project.. i am using debian 6 for my project and the objective of this project is to send the filename string using the tftp..my problem is i dont know how to display the filename string at the client..someone please help me..thank you

  2. i configured tftp server in my ubuntu system but i cant transfer file to remote system eg: windows xp ; timeout error shows whenever i transfer file to remote system and at the same time i can get the file in remote system-winxp can anyone help me for this problem and post ur answer please…..

  3. Assalamualaikum.. I am new with tftp..I have set up tftp to transfer file between two linux (using debian) VMware, my laptop as a client and desktop as a server.my laptop is using Wifi,but my desktop is connected with cable
    I have installed tftp on both..
    but how to transfer files between them? i have done this on client side:

    ./atftp (server ip address)
    tftp > get (filename)

    timeout: retrying…
    timeout: retrying…
    timeout: retrying…
    timeout: retrying…
    timeout: retrying…

    for now, it works fine when i transfer file on local host..
    i hope someone can help me..
    Thank you.

  4. I set ->
    sudo mkdir /tftpboot
    sudo chown nobody.nogroup /tftpboot
    sudo chmod 777 /tftpboot

    sudo vi /etc/default/tftpd-hpa

    RUN_DAEMON=”yes”
    OPTIONS=”-l -s /tftpboot”

    sudo ifconfig eth0 192.168.1.1
    sudo tftp 192.168.1.1

    tftp> get test.txt
    Transfer time out.

    Please what am i missing?

  5. I have completed with Tftp server installation and configuration in my host ubuntu system. Its working fine. But when trying to test it from qemu . i cannot test it. help me to test wthether tftp server working from qemu

  6. why i try to update image over tftp, getting following error. what is the issue ?

    TFTP from server 192.168.1.3; our IP address is 192.168.1.1
    Filename ‘xxxxx.img’.
    Load address: 0×80800000
    Loading: T T T T T T T T T T T

    • Looks like network issue. Some below if below things..
      1. You are setting the IP address of the target as 192.168.1.1, mostly it will be you routers IP (incase you have a router ) choose a IP that is not used by any device on you network
      2. Do a quick check if the server is reachable. Just od a ping to see if the host is reachable.

  7. I tried the steps mentioned, got it installed, but the problem arises in the testing part

    i execute the tftp connect command on the tftp server itself, just to be sure that am not being blocked by any firewall if i try to connect from other system.
    $ tftp 192.168.1.2
    tftp> get net.img
    After the above command, it doesn’t download anyting from the server and is just struck there

  8. Router#copy disk2:fromtftp.txt tftp:
    Address or name of remote host []? 10.10.10.10
    Destination filename [fromtftp.txt]?
    TFTP: error code 2 received – 16739

    %Error opening tftp://10.10.10.10/fromtftp.txt (Permission denied)

    How to resolve this!

  9. When i’m trying to create file in that directory:
    :/etc/xinetd.d$ sudo cat > tftpd
    bash: tftpd: Permission denied

    i’m using Ubuntu 12.04, i tried this in windows style, both with failure, i am so frustrated ARGHH

  10. Hi can anyone help me setting up tftp file transfer between two linux PCs?

    Pls provide exact steps for the same.
    1.should the both systems be connected thro cables?
    2.how to install tftp client?
    3.how to transfer the files between them?

    • You can use the above steps in the blog.
      1. In both PC’s execute all the above steps
      2. Then run to test tftp transfer between the PC’s only execute step 6, but use opposite PC’s IP here.

      Answer for your question.
      1.should the both systems be connected thro cables?
      As long as both the PC’s are in the same net work, or they are able to ping them each other then you can use tftp between them.
      You can also use WIFI.

      2.how to install tftp client?
      If you have folloed the instruction in this blog then you have installed the tftp client,
      where tftpd is server and tftp is client. Step 6 shows how to use tftp client

      3.how to transfer the files between them?
      Normally under all Linux OS due to security reason, You can get files from tftp server, but you can’t put.
      So consider using ftp for file transfer between PC’s

      All the best.

  11. hi all

    i tried the instruction…..also the chmod but it gives me this..

    sysadmin@sysadmin:/$ tftp 10.10.10.2
    tftp> get test
    tftp: test: Permission denied
    tftp> exit
    ?Invalid command
    tftp> quit
    sysadmin@sysadmin:/$ sudo chmod -R 777 /tftpboot
    sysadmin@sysadmin:/$ ls /tftpboot/test -lh
    -rwxrwxrwx 1 sysadmin sysadmin 132 2011-12-15 08:46 /tftpboot/test

    what’s wrong?

    thank you very much

    Marco

  12. Thank you for a wonderful info. it worked first time. Wish you can do the same for dhcp-server program. I have tried to follow the instructions but got failure installing it. Also dhcp3-server file was missing.

  13. i am using “sudo apt-get install xinetd tftpd tftp” command nut i got
    E: Unable to locate package xinetd
    E: Unable to locate package tftpd
    E: Unable to locate package tftp

    I am using Ubuntu 11.04 Ver.
    Y? can any one help me?

    • I am also using Ubuntu 11.04. where I can find the package’s using this command.

      $ apt-cache search xinetd
      update-inetd – inetd configuration file updater
      xinetd – replacement for inetd with many enhancements
      globus-gfork-progs – Globus Toolkit – GFork Programs
      rlinetd – gruesomely over-featured inetd replacement

      Try
      $ sudo apt-get update
      then install it again.

    • Please make sure you set the nameservers in /etc/resolv.conf
      then ping google.com to see if you have connectivity to internet
      Then try the sudo apt-get install xinetd tftpd tftp
      Because, when you are trying to install apps using apt-get, it searches for the
      repositories online and has to resolve the domain names to reach upto them

  14. Pingback: 2010 in review of my blog « Mohamed Thalib's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s