Running TFTP server on Ubuntu 14.04

# Install tftpd-hpa package
apt-get update
apt-get -y install tftpd-hpa

# Fix config file broken by default
# - use correct tftpboot directory rather than random location under /var
# - chroot to tftpboot
# - allow uploading of files but not overwriting existing
# - listen IPv4 and IPv6 instead of IPv6 only
# - enable logging
mv /etc/default/tftpd-hpa /etc/default/tftpd-hpa.old
cat <<'__EOF__' >/etc/default/tftpd-hpa
TFTP_USERNAME="tftp" 
TFTP_DIRECTORY="/tftpboot" 
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure --create --listen --verbose"
__EOF__

# Create tftpboot directory and use proper permissions
mkdir /tftpboot
chmod -R 1770 /tftpboot 
chown -R root:tftp /tftpboot

# Restart service
service tftpd-hpa restart

P.S. There's config file bug causing tftpd to listen only IPv6 connections by default... https://bugs.launchpad.net/ubuntu/+source/tftp-hpa/+bug/1448500

Comments

Post a Comment

Got something to say?!