Wednesday, June 3, 2009

Setting up a tftp server in ubuntu

1. Get the necessary packages
# sudo apt-get install xinetd tftp tftpd

2. Create tftp config file for xinetd
# sudo emacs /etc/xinetd/tftp
copy this text into the file, replace the \t's with tabs and insert the IP of the interface you want to use:

service tftp
{
\tprotocol = udp
\tport = 69
\tsocket_type = dgram
\twait = yes
\tuser = nobody
\tserver = /usr/sbin/in.tftpd
\tserver_args = -s /tftpboot
\tdisable = no
\tbind = <IP of the interface you want to use>
}


3. Create /tftpboot directory, open permissions on it, and set its owner to the nobody user.
# sudo mkdir /tftpboot
# sudo chmod -R 777 /tftpboot
# sudo chown -R nobody /tftpboot


4. Restart xinetd
# sudo /etc/init.d/xinetd restart

5. Test
# touch /tftpboot/testfile
# chmod 777 /tftpboot/testfile
# ls -l /tftpboot

note the time/date modified on testfile
# cd /tftpboot
# tftp <IP of the interface you ran tftp on>
#tftp> put testfile
#tftp> quit
# ls -l /tftpboot

if the time/date modified have changed then you have successfully overwritten the file.

No comments:

Post a Comment