Ubuntu10.04下的TFTP配置

来源:互联网 发布:织梦wap插件破解版 编辑:程序博客网 时间:2024/06/06 15:36

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





0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 割眼袋后有疤痕怎么办 摔到腰了很痛怎么办 坐久了腰椎疼怎么办 5个月的婴儿咳嗽怎么办 5个月宝宝湿疹怎么办 5个月宝宝干咳怎么办 6个月的宝宝咳嗽怎么办 4个月睡眠倒退期怎么办 科三五次没通过怎么办 打架时被抱住了怎么办 炸猫耳朵不脆怎么办 五个月宝宝脖子有点歪怎么办 婆婆不给带孩子怎么办 脚冻了怎么办 小妙招 pdf转word后乱码怎么办 李氏根源用多了怎么办 pdf在wps中打开怎么办 小孩刚上幼儿园哭闹怎么办 一到冬天皮肤痒怎么办 87岁老人身上痒怎么办 天刀技能拖不动怎么办 晚上不吃饭饿了怎么办 虚火引起的牙疼怎么办 吃上火了牙疼怎么办 慢性胃炎引起的口臭怎么办 烂牙引起的口臭怎么办 坏牙引起的口臭怎么办 牙齿拔了有口臭怎么办 胃疼连着后背疼怎么办 肚脐眼又红又痒怎么办 三岁宝宝有口臭怎么办 脚扭了按压疼痛怎么办 喝完酒头晕5天了怎么办 三岁宝宝口气重怎么办 肠镜检查出息肉怎么办 怀孕了口气很重怎么办 脚被重物压肿了怎么办 摔倒膝盖肿了应该怎么办 脚挤压伤肿了怎么办 30岁后脸上长斑怎么办 12岁脸上有雀斑怎么办