LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   tftpd-hpa on Ubuntu 6.10 - Error code 1: File not found (https://www.linuxquestions.org/questions/ubuntu-63/tftpd-hpa-on-ubuntu-6-10-error-code-1-file-not-found-578997/)

jim0112 08-22-2007 01:35 PM

tftpd-hpa on Ubuntu 6.10 - Error code 1: File not found
 
Hi,

I use a Linux machine to store Cisco IOS images and configurations. The TFTP service was recently migrated to this box as the old one (which was running Ubuntu 6.06) died.

I can get files OK but for some reason I can't put any files using TFTP. I have tried from LAN PCs as well as localhost.

Package: tftpd-hpa

Service is running:

jim@lx-p4:~$ netstat -ul | grep tftp
udp 0 0 *:tftp *:*

jim@lx-p4:~$ ps aux | grep tftp
root 22553 0.0 0.0 2100 308 ? Ss 19:08 0:00 /usr/sbin/in.tftpd -l -s /tftpboot

Here are the configuation files:

jim@lx-p4:~$ cat /etc/default/tftpd-hpa
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /tftpboot"

jim@lx-p4:~$ cat /etc/xinetd.d/tftp
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = -l -s /tftpboot
disable = no

This is what happens:

jim@lx-p4:~$ tftp -v localhost
Connected to localhost.localdomain (127.0.0.1), port 69
tftp> get test2.txt
getting from localhost.localdomain:test2.txt to test2.txt [netascii]
tftp>
tftp>quit

jim@lx-p4:~$ ls *.txt
test2.txt

jim@lx-p4:~$ sudo rm /tftpboot/test2.txt

jim@lx-p4:~$ tftp -v localhost
Connected to localhost.localdomain (127.0.0.1), port 69
tftp> put test2.txt
putting test2.txt to localhost.localdomain:test2.txt [netascii]
Error code 1: File not found

This is a different error to the one I get if I try to send a file that doesn't exist:

tftp> put fakefile
tftp: fakefile: No such file or directory

Some Googling revealed the suggestion that I should try to specify the absolute path to the file, but it didn't work and you shouldn't have to do that, I believe.

Any suggestions would be gratefully received - thanks!

doublejoon 08-31-2007 07:08 AM

Change
Code:

server_args = -l -s /tftpboot
To
Code:

server_args = -c -s /tftpboot
And make sure nobody owns /tftpboot

jim0112 09-11-2007 03:44 AM

Hi,

Thanks for the reply. I've changed to -c:

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

tftpboot was already owned by nobody, although the group is root - there isn't a nobody group?

drwxrwxrwx 2 nobody root 4096 2007-09-05 14:45 tftpboot

Things have now got a bit weirder. I can now put files, if I'm overwriting a file that is already there. If it isn't, I get the original error!

For example:

root@lx-p4:/# cd /home/jim
root@lx-p4:~# touch testfile2b
root@lx-p4:~# chmod 666 testfile2b
root@lx-p4:~# tftp -v localhost
Connected to localhost.localdomain (127.0.0.1), port 69
tftp> put testfile2b
putting testfile2b to localhost.localdomain:testfile2b [netascii]
Error code 1: File not found
tftp> quit
root@lx-p4:~# cp /home/jim/testfile2b /tftpboot
root@lx-p4:~# tftp -v localhost
Connected to localhost.localdomain (127.0.0.1), port 69
tftp> put testfile2b
putting testfile2b to localhost.localdomain:testfile2b [netascii]
tftp>

root@lx-p4:~# ls -la /tftpboot
total 8
drwxrwxrwx 2 nobody root 4096 2007-09-05 14:45 .
drwxr-xr-x 22 nobody root 4096 2007-09-05 14:42 ..
-rwxrwxrwx 1 nobody root 0 2007-09-05 14:46 testfile2b

patcou 08-25-2009 06:19 PM

tftpd-hpa problems
 
FYI - I discovered that in order to PUT a file, I had to change the startup flag from -l to -c (as shown earlier), make sure the directory was read/write, and I had to specify the destination as a fully qualified path:

tftpd -i 192.168.0.1 PUT x.tgz /tftpdump/x.tgz

I hope this helps someone out there !


All times are GMT -5. The time now is 03:24 AM.