Ubuntu下安装tftp

在Ubuntu系统上安装tftp方法:

--------------------------------方法1----------------------------------

1. 安装包
$ sudo apt-get install tftp-hpa tftpd-hpa

2. 设置tftpd
$ sudo vim /etc/default/tftpd-hpa

RUN_DAEMON="yes" #改为yes,表示启动守护进程,tftpd工作
OPTIONS="-l -s /tftpboot" #改为/tftpboot, 表示tftp客户端能取得的文件所存放的位置

3. 启动服务(通过这个文件调用in.tftpd)
$ sudo /etc/init.d/tftpd-hpa start

4. 查看服务是否开始工作
$ sudo netstat -pna|grep tft

5. 测试, 先拷贝一个文件a.txt到目录/tftpboot,然后连接tftp
$ tftp localhost
tftp> get a.txt
tftp> quit
$ ls

如果仍有问题,卸载后重新安装
$ sudo apt-get remove tftpd-hpa
复位重新启动Ubuntu系统
$ sudo apt-get install tftpd-hpa
再重复上边的设置.

--------------------------------方法2(没有试过)--------------------------

1. 安装包
$ sudo apt-get install tftp-hpa tftpd-hpa inetutils-inetd

2. 在/目录下建一个tftpboot, 把属性改成777。
$ cd /
$ sudo mkdir tftpboot
$ sudo chmod 777 tftpboot

3. 修改/etc/inetd.conf
$ sudo vim /etc/inetd.conf

tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot

4. 重新加载inetd进程
$ sudo /etc/init.d/xinetd reload

5. 启动tftp服务器(这一步应当不需要,因为这是通过inet方法的tftp功能. 需要验证)
$ sudo in.tftpd -l -s /tftpboot

6. 测试, 拷贝一个文件a.txt到目录/tftpboot
$ tftp localhost
tftp> get a.txt
tftp> quit
$ ls

--------------------------------资料参考--------------------------------

1. 文件 /etc/default/tftpd-hpa 说明:

#Defaults for tftpd-hpa
RUN_DAEMON="no"
OPTIONS="-l -s /var/lib/tftpboot"

修改设置如下:
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /home/nathanliu/tftpboot"
其中/home/nathanliu/tftpboot是自己设定的目录,可以根据情况修改。

选项参考
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 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.

-----------------------------------------------------------------------

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值