Friday, October 26, 2007

Setup tftp server on Ubuntu/Kubuntu

1. Install needed software

$sudo apt-get install xinetd tftpd tftp

2. vim /etc/xinetd.d/tftp and put this entry:

service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /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. Transfer file rex.rex from 10.10.1.1 (Client using tftp) to
192.168.1.100 (Server 10.10.1.1):

root@BIKOL:/# touch rex.rex
root@BIKOL:/# chmod 777 rex.rex
root@BIKOL:/# tftp 10.10.1.1
tftp> put test.txt
tftp> quit
root@BIKOL:/# ls /tftpboot/ -l
total 0
-rw------- 1 nobody nogroup 0 2007-10-26 13:45 rex.rex

Credits: http://www.davidsudjiman.info/?p=93

1 comment:

Harry Sufehmi said...

Thank you, I was having "forbidden directory" errors.

Turned out because the config file lacked the -s parameter.

Here's my tftpd's xinetd config file, may others benefit from it as well :

service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
}

Thanks again.