You are not logged in.

#1 2021-09-14 19:22:01

regexaurus
Member
Registered: 2021-09-14
Posts: 7

tftp-hpa - attempts to get or put files fail

Hopefully this is the correct board category for this question.

I installed tftp-hpa:

$ sudo pacman -Su tftp-hpa

and added "--create --verbosity 5" to /etc/conf.d/tftpd, so it now contains:

TFTPD_ARGS="--secure /srv/tftp/ --create --verbosity 5"

and started/enabled:

$ sudo systemctl start tftpd
$ sudo systemctl enable tftpd
$ sudo systemctl status tftpd

● tftpd.service - hpa's original TFTP daemon
     Loaded: loaded (/usr/lib/systemd/system/tftpd.service; enabled; vendor preset: disabled)
     Active: active (running)

For testing, there is a file /srv/tftp/tftpdman.txt

I installed the tftp client (native, Windows feature) on a Windows 10 system. If I try to get a file from a Windows Command Prompt:

tftp archhostname get tftpdman.txt (where archhostname is the hostname for the Arch system running tftpd)

I eventually see, "Connect request failed." But in journalctl output, I see a number of entries of the form, "RRQ from 192.168.1.29 filename tftpdman.txt," where 192.168.1.29 is the IP address of the Windows tftp client.

If I try:

tftp archhostname put ClearIconStreams.ps1, I eventually see, "Connect request failed." But in journalctl output, I see a number of entries of the forms, "WRQ from 192.168.1.29 filename ClearIconStreams.ps1" and "sending NAK (1, File not found) to 192.168.1.29" and I see the (empty) file /srv/tftp/ClearIconStreams.ps1, with user/owner and group nobody:
-rw-rw-rw- 1 nobody nobody    0 Sep 14 14:27 ClearIconStreams.ps1

Based on some web sleuthing and experience (user/owner and group on created ClearIconStreams.ps1 file), I found that tftpd is running as nobody by default. /srv and everything under it (including tftpdman.txt) was user/owner and group root by default. I thought this may be the problem and did:

$ sudo chown nobody:nobody -R /srv

Based on a suggestion I came across, I changed permissions:

$ sudo chmod 777 /srv/tftp

After all the changes, I also restarted tftpd for good measure. None of this has helped. I cannot get or put files. I suspect it might be related to tftpd running as nobody, but I'm not sure and don't know the best approach, if this is the problem.

I would appreciate your suggestions!

Last edited by regexaurus (2021-09-14 20:44:16)

Offline

#2 2021-09-14 20:12:52

regexaurus
Member
Registered: 2021-09-14
Posts: 7

Re: tftp-hpa - attempts to get or put files fail

I'm not sure what this means, but if I do this from the Arch system:

$ ls
$ tftp localhost
tftp> get tftpdman.txt
tftp> quit
$ ls
tftpdman.txt

I can see the file is transferred to the current working directory. I'm not sure what this means...

Offline

#3 2021-09-15 09:14:17

solskog
Member
Registered: 2020-09-05
Posts: 416

Re: tftp-hpa - attempts to get or put files fail

Try first from your localhost then from LAN. You don't need everybody has access to your /srv/tftp/, only the "rwx" for nobody is required as the owner of the directory.

# chmod 770 /srv/tftp/
# stat /srv/tftp/
Access: (0770/drwxrwx---)  Uid: (66634/  nobody)   Gid: (66634/  nobody)

But, to access files inside /srv/tftp/ directory, you need give everybody read access to these files.

# chmod 444 /srv/tftp/tftpman.txt

"sending NAK (1, File not found) to 192.168.1.29"
# man in.tftpd
--create, -c
Allow new files to be created.  By default, tftpd will only allow upload of files that already exist.

Therefore you need to add "--create" option to the server.

# cat /etc/conf.d/tftpd
TFTPD_ARGS="-vvv --secure /srv/tftp/ --user nobody --create"
...
# tftp -m binary -v $host -c put $infile $infile
# tftp -m binary -v $host -c get $infile $infile

Last edited by solskog (2021-09-15 09:40:28)

Offline

Board footer

Powered by FluxBB