How to configure tftpd-hpa to allow upload of new files?
I have a 52 u rack w/ multiple cisco switches and routers. I also have an ubuntu server w/ kvm installed. I created a vm w/ ubuntu 12.04 installed for use as a tftp server to transport images between it and my networking equipment. I installed tftp-hpa, tftpd-hpa and xinetd on it per various guides on this site and others.
After much pain and frustration, I was able to tftp locally on the host and from my windows machine. The thing is I have to create empty files for each file I want to upload to the server under the "nobody" user in the /var/lib/tftpboot directory using the following command:
sudo -u nobody sh <<< "cd /var/lib/tftpboot; touch filename; chmod 777 filename" BOTTOM LINE UP FRONT: I want to simply be able to "tftp put" any file I want w/out having to use the command above to create a file first. Please help me before I start breaking expensive things! Here is my xinetd.d tftp config:
service tftp { disable = no socket_type = dgram wait = yes user = root server = /usr/sbin/in.tftpd server_args = -v -s /var/lib/tftpboot } 1 Answer
From tftpd's manpage:
--create, -c Allow new files to be created. By default, tftpd will only allow upload of files that already exist. Files are created with default permissions allowing anyone to read or write them, unless the --permissive or --umask options are specified.Change server_args to:
server_args = -c -v -s /var/lib/tftpbootYou don't need xinetd to get tftpd up and running. This is how I install and configure tftpd:
sudo aptitude install tftpd-hpa
sudo chown -R tftp /var/lib/tftpbootEdit /etc/default/tftpd-hpa to insert -c into TFTP_OPTIONS. The line should look like:
TFTP_OPTIONS="--secure -c"Finally, restart tftpd service:
sudo service tftpd-hpa restart