1)安装tftp-hpa,tftpd-hpa, xinetd
~$ sudo apt-get install tftp-hpa ,tftpd-hpa, xinetd
2) 在/etc/xinetd.d/下创建并配置tftp文件
~$ sudo vim /etc/xinetd.d/tftpd
1 service tftp
2 {
3 socket_type = dgram
4 protocol = udp
5 wait = yes
6 user = root
7 server =/usr/sbin/in.tftpd
8 server_args =-s/tftpboot -c
9 disable = no
10 per_source = 11
11 cps =100 2
12 flags = IPv4
log_on_success = PID HOST DURATION
log_on_failure = HOST
13 }
-c 用于开启上传功能。
3)配置tftpd-hpa
~$ sudo vim /etc/default/tftpd-hpa
1 #/etc/default/tftpd-hpa
2
3 TFTP_USERNAME="tftp"
4TFTP_DIRECTORY="/tftpboot"
5TFTP_ADDRESS="0.0.0.0:69"
6 TFTP_OPTIONS="-l -c -s"
其中/tftpboot为 tftp共享目录
4) 修改xinetd.conf文件
~$ sudo vim /etc/xinetd.conf // inetd.conf
defaults
6 {
7
8 # Please note that you need a log_typeline to be able to use log_on_success
9 # and log_on_failure. The defaultis the following :
10 # log_type = SYSLOG daemon info
11
12 }
13
14 #includedir /etc/xinetd.d
15 tftp dgram udp wait nobody/usr/sbin/in.tftpd /usr/sbin/in.tftpd /tftpboot
5) 重启tftp服务并测试
sudo service tftpd-hpa restart
sudo /etc/init.d/xinetd reload
sudo /etc/init.d/xinetd restart
6)本机测试
在/tftpboot下创建测试文件love
#cd /tftpboot
#echo xuguodongaigongxia > test
#chmod 777 test
测试一下 tftp服务:
重新打开一个终端
#tftp 127.0.0.1
tftp>get test
tftp>q