软件安装
sudo apt install xinetd tftp-hpa tftpd-hpa
软件配置
tftp
sudo vi /etc/xinetd.d/tftp
配置如下(若/etc/xinetd.d/下无tftp,可自行创建):
service tftp
{
socket_type = dgram
wait = yes
disable = no
user = root
protocol = udp
server = /usr/sbin/in.tftpd
server_args = -c -s /tftproot
per_source = 11
cps = 100 2
flags = IPv4
}
tftpd-hpa
sudo vi /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftproot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s"
69指的是端口号
TFTP_ADDRESS="0.0.0.0:69"
tftproot目录
创建目录
没错!这个目录就是上文配置中反复出现的目录的。
可以根据自己的喜好命名,也可以根据自己的喜好指定路径。
sudo mkdir /tftproot -p
修改权限
sudo chmod 777 /tftproot
重启服务
sudo /etc/init.d/tftpd-hpa restart
sudo /etc/init.d/xinetd restart
出现以下错误,说明端口号被占用,可修改/etc/default/tftpd-hpa中的端口号。
sudo /etc/init.d/tftpd-hpa restart
[....] Restarting tftpd-hpa (via systemctl): tftpd-hpa.serviceJob for tftpd-hpa.service failed because the control process exited with error code.
See "systemctl status tftpd-hpa.service" and "journalctl -xe" for details.
failed!