- 关闭 xinetd服务
$sudo service xinetdstop - 删除 tftp文件
$sudo rm /etc/xinetd.d/tftp - 启动 xinetd 服务
$sudo service xinetdstart $sudo apt-getinstall tftp-hpa $sudo apt-getinstall tftpd-hpa $vim /etc/default/tftpd-hpa 修改 “/var/lib/tftpboot” 为 “/tftpboot” 修改 "--secure" 为 "--secure -c" 允许上传新文件 $sudo mkdir /tftpboot $sudo chmod 777 /tftpboot $sudo service tftpd-hpa restart 若服务重启成功,能查看到相应的进程
$ps -ef |grepin.tftpd 在终端执行命令:
tftp 对方ip地址 下载文件:get 文件名 上传文件:put 文件名 退出:quit
至此 tftp服务已经安装完成了,下面可以对其进行一下测试。(假设在当前目录下有一个测
试文件 test.txt)
$tftp127.0.0.1 tftp> put test.txt Sent 1018 bytes in 0.0seconds tftp> get test.txt Received1018 bytes in 0.1 seconds tftp> quit $ 通过 get 命令,可以把当前目录下的 test.txt 文件,通过 tftp 上传到它的服务文件目录。这时,在/tftpboot 下面会出现 test.txt 文件。通过 put 命令,可以从/tftpboot 下,下载 test.txt文件。这样就验证了 tftp 服务配置的正确性。当文件上传与下载结束后,可以通过 quit 命令退出。
文章来源: tftp服务