Ubuntu10.04下的TFTP配置

ubuntu 下可以使用的tftp服务器有三种:前面是客户端,后面是服务器端

1tftptftpd

2atftpatftpd

3tftp-hpatftpd-hpa

我所使用的是第三种

1安装tftp客户端和服务器端

apt-get install tftp-hpa tftpd-hpa xinetd

2、建立tftp服务文件目录(上传文件与下载文件的位置),并且更改其权限

#sudo mkdir /tftpshare

#sudo chmod 777 /tftpshare


3、修改配置文件,添加共享目录

gedit /etc/default/tftpd-hpa


TFTP_DIRECTORY = “/tftpshare”     //设置tftp目录,将自己的tftp目录填上去,将默认的目录注释掉

TFTP_OPTIONS = “-l  -c  -s”      //设置tftp目录的属性



其中:

1

OPTIONS="-l -s -c /home/crifan/develop/tftpboot"

中的参数含义为:

-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.

 

-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.

注意其中的-c, "-c为可创建新文件,若无此参数,put命令则可能出现错误提示,此时只能覆盖原有文件不能创建新文件;"

4、重启服务

#sudo service tftpd-hpa  restart              //重启服务器


注意这里一定要有process,否则就是没成功

 

其中:

1)关于重启 某个服务,之前的LinuxUbuntu10.10之前)都是这样操作的:

sudo /etc/init.d/XXX reload

对于inetd来说,就是:

sudo /etc/init.d/inetd reload

现在新的LUbuntu 10.10中,是统一成调用service来操作了:

sudo service XXX restart

其中,启动和停止对应的是startstop

2)记得不要少了sudo,否则“stop: Rejected send message”的错误。

3)【确认tftp服务是否已经开启】

查看tftp相关进程:

ps aux|grep tftp



如果能看到像上面的 /usr/sbin/in.tftpd已经启动,就说明tftp服务已经开启了。

此处可以看到:

--listen就是对应的配置文件中的参数 -l

--user tftp就是对应配置文件中的参数 TFTP_USERNAME="tftp"

/tftpshare就是对应的配置文件中的参数 TFTP_DIRECTORY=" /tftpshare"

 

5.验证tftp是否生效

将任意一个文件放到tftp目录下,我新建了一个00文件

 tftp 127.0.0.1

 tftp>get 00 

 tftp>quit





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值