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.

Posted in Software. Tags: , . 17 Comments »

17 Responses to “Installing and Testing TFTP Server in Ubuntu/Debian”

  1. gruberator Says:

    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

  2. shushma Says:

    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?

    • mohammadthalif Says:

      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.

  3. Marco Says:

    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

    • mohammadthalif Says:

      The current directory where you are is not having write permission for your user. so change to some a directory where you have write permission eg. home path

      $ cd ~/

      Now test the tftp, it should work..

      All the best.

      • Marco Says:

        you right………after the post i found the solution…..’cause it worked with ” sudo tftp ”
        thank you man….and sorry for time wasted
        ;-)

        c ya

  4. Joni Zhao Says:

    I like this web site very much so much great information.

  5. abbasd Says:

    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.

  6. Blake Peccia Says:

    Appreciate it for all your efforts that you have put in this. very interesting info . “Never trust the advice of a man in difficulties.” by Aesop.

  7. Ramesh Says:

    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?

    • mohammadthalif Says:

      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.

  8. Alex Says:

    Great. Simple and very clear. Congratulations.

  9. 2010 in review of my blog « Mohamed Thalib's Blog Says:

    [...] Installing and Testing TFTP Server in Ubuntu/Debian March 2010 4 comments 4 [...]

  10. Budi Wahyudi Says:

    Thanks
    I have success follow instruction Installation

    but I try put file from other computer to tftp server got “Access Violation”

    how to set it for allowing upload file from outside tftpd server?


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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.