Ubuntu 安装TFTP server

Ubuntu中有三个常用tftp服务器:atftpd,tftpd,hpa;

安装hpa过程:

自建tftp目录:sudo mkdir /home/tftp

修改目录属性:sudo chmod 777 /home/tftp

tftpd-hpa 是一个功能增强的TFTP服务器。它提供了很多TFTP的增强功能,它已经被移植到大多数的现代UNIX系统。

安装
使用下面的命令来安置 tftpd-hpa 服务器:

$ sudo apt-get install tftpd-hpa
注:若server未安装xinetd则在Ubuntu10.04中会自动下载openbsd-inetd并安装,使用tftp过程中出错很多时候是因xinetd版本问题;

配置
tftp-hpa 的配置文件为 /etc/default/tftpd-hpa


#Defaults for tftpd-hpa

RUN_DAEMON="yes" #默认为"no",tftp不能启动;

OPTIONS="-l -c -s /home/tftp"

#/home/tftp为你设定目录,-c可创建新文件,在很多资料中执行的命令或配置tftp文件中都缺少-c这个参数,如:sudo in.tftpd -l -c -s

/home/tftp,put命令会出错提示;

注意要修改目录属性:chmod 777 /home/tftp

启动和停止
启动
# /etc/init.d/tftpd-hpa start
停止
# /etc/init.d/tftpd-hpa stop

校验:ps -A|grep tftp

删除服务:sudo apt-get remove tftpd-hpa tftp-hpa --purge

测试
在/home/tftproot下随便创建个文件,然后登录tftp,能get下来就OK了。

以下指令时链接本地tftp服务器并get一个已存在文件。

stv@super:~/workspace$ tftp 127.0.0.1
tftp> get test.txt
Received 12 bytes in 0.0 seconds
tftp> quit


选项参考

OPTIONS

-l Run the server in standalone (listen) mode, rather than run from

inetd. In listen mode, the -t option is ignored, and the -a

option can be used to specify a specific local address or port

to listen to.

-a [address][:port]

Specify a specific address and port to listen to when called

with the -l option. The default is to listen to the tftp port

specified in /etc/services on all local addresses.

listen 的 ip address 和 Port

-c Allow new files to be created. By default, tftpd will only

allow upload of files that already exist. Files are created

with default permissions allowing anyone to read or write them,

unless the -p or -U options are specified.

-s (决定tftp根目录)Change root directory on startup. This means the remote host

does not need to pass along the directory as part of the trans-

fer, and may add security. When -s 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值