atftpd
Contents
About
advanced TFTP server
Multi-threaded TFTP server implementing all options (option extension and multicast) as specified in RFC1350, RFC2090, RFC2347, RFC2348, RFC2349 and RFC7440. Atftpd also supports the multicast protocol known as mtftp, defined in the PXE specification. The server is socket activated by default but supports being started from inetd(8) as well as in daemon mode using init scripts.
Installation
Install atftpd server component
1 apt install atftpd
You may also want to install the client to test it
1 apt install atftp
Configure
Create a group tftp
1 addgroup --system tftp
Add you user to the group
1 adduser tobias tftp
Create the directory to be served and set the SGID bit, to ensure all files and directories created below this directory belong to group tftp. Nobody may view and enter the directory but is not allowed to write to the tftp root directory.
1 install -o root -g tftp -m 2775 -d /srv/tftp
Add a writable sub-directory below /srv/tftpd
1 install -o root -g tftp -m 2777 -d /srv/tftp/inbound
Defaults
/etc/default/atftpd
Logging
By default atftpd logs to syslog
1 tail -f /var/log/daemon.log | grep atftpd
If you are having trouble change the severity to --verbose=7 and restart the service. This is very helpful!
Systemd configuration
By default atftpd is activated by a socket.
/usr/lib/systemd/system/atftpd.socket
/usr/lib/systemd/system/atftpd.service
The flag DynamicUser=yes implies some rigorous constraints to the service disallowing writes to the served directory. Please see:
man 5 systemd.exec
Following Flags are implied:
RemoveIPC=yes
ProtectHome=read-only
NoNewPrivileges=yes
RestrictSUIDSGID=yes
ProtectSystem=strict
To allow writing create an systemd override
/etc/systemd/system/atftpd.service.d/override.conf
using
systemctl edit atftpd.service
RemoveIPC=yes
ProtectHome=read-only
NoNewPrivileges=yes
RestrictSUIDSGID=yes
ProtectSystem=strict
The corresponding error looks like this in tftp-hpa
The corresponding error looks like this in atftp
Using the client from cli
Create a test file
1 dd if=/dev/urandom of=/tmp/file.1m bs=1M count=1
atftp
Upload a file with atftp
Download a file with atftp
tftp-hpa
Upload a file with tftp-hpa
1 tftp localhost -v -c put "/tmp/file.1m" "/rw/file.1m"
Download a file with tftp-hpa
1 tftp localhost -v -c get "/rw/file.1m" "/tmp/file.1m_down"