Installing and setting TFTPD in Ubuntu
by David Sudjiman ~ March 27th, 2006. Filed under: Linux.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
June 17th, 2006 at 11:20 pm
Hallo David,
thank you for the description. I found a lot of sites about netbooting, but setting up the tftp-server wasn’t clear to me until I found your page. Stefan
July 20th, 2006 at 2:08 am
Very helpful; this was driving me insane because I needed to get it running for a work-related project. Thanks for the information.
July 25th, 2006 at 11:13 am
It helped me too, thanks!!
July 29th, 2006 at 5:42 am
I have been attempting to get tftpd to run for a few days now and have still had zero luck…… for some reason it does not srart/listen on port 69…. or any port for that matter…. any ideas?
Thanks
William
August 2nd, 2006 at 1:15 pm
Thanks, my tftp server is working now.
August 7th, 2006 at 7:08 am
Dude, thank you so much ! xinetd hint worked perfectly !
August 22nd, 2006 at 8:23 am
Another success here. As mentioned, there are a lot of sites that describe setting up a TFTP to boot a PXE from, but nothing about setting up tftpd in Ubuntu. The only difference is after running through the steps I still could not connect to the TFTP server until I did /etc/init.d/xinetd restart.
August 27th, 2006 at 3:34 am
Thanks David,
I was cracking my head for two days to make the tftp server running in my system. your page helped me to start the tftp in 5mins. Thanks.
September 16th, 2006 at 3:49 am
Hey thanks for posting this… I was starting to pull out my non-existant hair on how to do this.
All i keep seeing is how do a netwwork boot
October 29th, 2006 at 5:56 pm
Hello,
you need -s before the tftp root directory making the server_args like:
server_args = -s /tftpboot
apart from that it works OK.
November 14th, 2006 at 2:43 am
Thanks David and DoudZ !!
November 24th, 2006 at 9:19 pm
Thanks a lot, but when I finished this tutorial I had a very stupid “problem”: the whitespaces in the /etc/xinet.d/tftp file. I didn’t use them and they are mandatory….
I hope this to be usefull for someone.
March 4th, 2007 at 9:25 am
I am new to linux and I found a thousand sites explaining to me how to setup a tftp server but none of them explained that I needed to install xinetd.d. Thank you very much this has to be the simplest and most informative how to site thank you.
March 22nd, 2007 at 2:37 pm
Indeed, I concur with everyone that this was:
1. the most helpful
2. the simplest
information on installing tftp. I also tried using atftp(d), but this was the only success I had.
Thanks, DS!
April 18th, 2007 at 4:12 am
Thanks for this, it worked mostly.
However, on Ubuntu 6.10, I had to change the user to root, as “nobody” is not associated with an existing group and that caused problems during the startup of xinetd.
If you run into issues, it helps to check /var/log/syslog (or the equivalent for your Linux) to see those error messages. Yes, I’m pretty new to this, suffering from too many years of Windoze abuse, so bear with me.
The easiest solution I came up with (maybe not the right one), was to change the user used by tftp to “root”. That worked.
Here’s my /etc/xinet.d/tftp. “-c” allows it to create files in that directory
service tftp
{
disable = no
protocol = udp
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -u root -c -s /tftpboot
}
May 17th, 2007 at 3:02 am
I’ve tried this on Fiesty Fawn, but “apt-get install xinetd” results in an error message which indicates that package xinetd is not available. Is there some new method?
June 20th, 2007 at 6:57 am
Here’s how I got it working in feisty.
#1. Install tftpd with dependencies - no xinetd, I never could get it to work right.
#2. Reboot. Tried everything to make it work without rebooting, I can’t seem to get it.
#3. sudo mkdir /srv/tftp
sudo chown -R nobody tftp
/srv/tftp is your tftp directory. Works quite well now.
June 21st, 2007 at 2:22 pm
nice , i tryd more sites but i can’t get this solution , thanx…
July 2nd, 2007 at 12:01 pm
Thanks! I had real trouble with this until I found your page.
September 13th, 2007 at 7:45 am
Very useful i run my tftp server in 1 minute. very clear instruction. Thanks
October 18th, 2007 at 6:02 am
Excelent. I’m new to linux, but moving really fast. Fortunately this was the first site I visited. I first did a
“sudo apt-get install ftpd” but it told me the superserver was not found. Then I visited this site and got it working. Thanks.
November 12th, 2007 at 2:26 am
Thank you, hours with minicom and 10 mins with your instructions. thanks
November 28th, 2007 at 9:25 pm
hello, I have followed your tutorial, but when i do ” >put essai.txt” ihave this message “transfer timed out”.
thinks
December 17th, 2007 at 10:05 am
Note that this only worked for me when I made the lines between the { } braces tab-indented.
service tftp{
[tab]port = 69
…
}
December 20th, 2007 at 3:38 am
On Ubuntu 6.10 this isn’t working. Tried all the above suggestions but the transfers are timing out..
Anyone found a solution to this?
January 20th, 2008 at 4:03 am
work well indeed sofar.thanks
ps:
but one might need to change above ip-adress to your own i.e. 192.168.0.1 in my case.
January 23rd, 2008 at 5:40 am
Running ubuntu server 7.04–
I have the tftp server working as specified, but file transfers ONLY work internally either on itself or within a local network.
As soon as I attempt to transfer over the internet, i get
“Transfer timed out.”
or another error if i do not have -s in serverags.
whats up?
February 2nd, 2008 at 6:40 am
To run the deamon you have to enable this often default-disabled option in:
/etc/default/tftpd-hpa
RUN_DAEMON=”yes”
to test if tftpd is running try:
netstat -a | grep tftp
the result shoud be:
udp 0 0 *:tftp *:*
February 2nd, 2008 at 8:11 am
TO THE MOD:
sorry stupid me.. forgott half of it.
Wanted to say using tftp-hda is a good alternative on debian/ubuntu
install with
aptitude install tftpd-hpa
then configure it like above and start with
/etc/init.d/tftpd-hda start
sorry for scrambling it up, but i didnt have much time.. maybe you could sort it out or add it to your own howto
thanks
February 6th, 2008 at 6:48 am
Hi CodeWiZzard-
Thanks for your reply… I tried your method on 7.04 and then re-formatted and tried on 7.10 and still no luck. Still timing out.
I am running out of ideas, and I definatly dont want to run CentOS or Windows just to serve tftp files…
Any other thoughts?
Thanks,
February 15th, 2008 at 4:59 am
Thanks, this worked after I realized that I made the same mistake as j mollo (see above). I added tabs to the front of the lines in the /etc/xinetd.d/tftp file and then it worked. We also had problems with a tftp/UDP blocking rule on our corporate firewall/gateway.
February 21st, 2008 at 5:05 am
Many thanks !!!
April 2nd, 2008 at 9:10 am
Nice work, thanks David and DoudZ !!
April 11th, 2008 at 11:20 pm
Thanks David…I so simple after read your post…Bye From Italy
April 22nd, 2008 at 3:51 pm
Great work David! Thank you for clear, easy to follow instructions.
May 4th, 2008 at 8:22 pm
Need help guys! I am using Ubuntu 7.10 and managed to set up the ftp as instructed. But when I try to to the step: tftp> put hda.txt
I got a message that: tftp: No such file or directory
Any idea where am I making mistake.
Thanks
May 6th, 2008 at 1:13 am
Amir you should have TFTP service files on you root partition after this you have to copy this file on /var/lib/tftpboot
May 13th, 2008 at 3:38 am
Great work David! Thank you for clear, easy to follow instructions.
May 19th, 2008 at 6:25 pm
hey!!
easiest tutorial I found on the net
however tftp works only internally –I cannot boot a client –it simply says tftp open timeout!
I have a multihomed network with subnets 192.168.40.0 and 10.10.1.0 and I can use tftp internelly on both
May 30th, 2008 at 12:44 am
You helped me. Thanks a lot.
June 12th, 2008 at 7:17 pm
Hi,
Thanks David for the description.
from Germany