tftp,即简单文件传输协议,是借助于UDP协议实现简单的文件传输。
环境
Linux vm 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
安装
1. 使用apt工具下载并安装tftpd-hpa
执行命令:
sudo apt install tftpd-hpa
2. 配置tftp服务参数(/etc/default/tftpd-hpa)
sudo vim /etc/default/tftpd-hpa
修改tftp服务根目录,如下所示:
TFTP_USERNAME=”tftp”
TFTP_DIRECTORY=”/opt/tftp”
TFTP_ADDRESS=”0.0.0.0:69″
#tftpd-hpa: Error code 2: Only absolute filename
TFTP_OPTIONS=”-s”
3. 重启tftp服务
sudo /etc/init.d/tftpd-hpa restart
4. 问题解决:
在ubuntu 12.04下安装tftpd-hpa以后,默认的启动选项要求在tftp客户端下载文件时指定绝对路径,如果不指定就提示下面的错误:
Quote:
Error code 2: Only absolute filenames allowed
很麻烦,所以最好是指定一下,办法是修改/etc/default/tftpd-hpa文件,在里头的TFTP_OPTIONS中加上-s选项。
TFTP_OPTIONS=”-s”
该选项的作用(man tftpd):
Quote:
Change root directory on startup. This means the remote host does not need to pass along the directory as part of the transfer, and may add security. When –secure is specified, exactly one directory should be specified on the command line. The use of this option is recommended for security as well as compatibility with some boot ROMs which cannot be easily made to include a directory name in its request.
之后关闭并重启tftpd-hpa服务。