【教程】ubuntu中配置tftp

1.

安装

tftpd

(

tftp

服务器)、

tftp

(

tftp

客户端)以及

xinetd

(超级服务器)

1.

安装

tftpd

(

tftp

服务器)、

tftp

(

tftp

客户端)以及

xinetd

(超级服务器)

1.

安装

tftpd

(

tftp

服务器)、

tftp

(

tftp

客户端)以及

xinetd

(超级服务器)

1.

安装

tftpd

(

tftp

服务器)、

tftp

(

tftp

客户端)以及

xinetd

(超级服务器)

Preface

 

   今天在 Ubuntu 12.04LTS下配置 tftp时走了些弯路,囧,记录下

 


下面的方案怎么也工作不起来

 

   1.安装tftpd(tftp服务器)、tftp(tftp客户端)以及xinetd(超级服务器)

#sudo apt-get install tftpd tftp xinetd

 

   2.建立配置文件,创建/etc/xinetd.d/tftp文件,并在文件中添加如下内容

mystery@lcw:/etc/xinetd.d$ sudo vim tftp
  1 service tftp                                                            
  2 {
  3         disable = no
  4         socket_type = dgram
  5         protocol = udp
  6         wait = yes
  7         user = mystery
  8         server =/usr/sbin/in.tftp
  9         server_args = -s /home/mystery/tftp
 10         source = 11
 11         cps = 100 2
 12         flags = IPv4
 13 }

 

   3.建立配置文件,创建/etc/xinetd.d/tftp文件,并更改权限

mystery@lcw:~$ sudo mkdir /home/mystery/tftp
mystery@lcw:~$ sudo chmod -R 777 /home/mystery/tftp
mystery@lcw:~$ sudo chown -R mystery /home/mystery/tftp
mystery@lcw:~$

 

    4. 通过xinetd超级服务器启动tftpd

      在这之前,先重启下进程

mystery@lcw:/etc$ sudo reload xinetd

      然后重启服务

mystery@lcw:/etc/default$ sudo service xinetd restart
xinetd stop/waiting
xinetd start/running, process 3350
mystery@lcw:/etc/default$

 

   5. 测试

tftp> status
Connected to 192.168.123.24.
Mode: netascii Verbose: off Tracing: off
Rexmt-interval: 5 seconds, Max-timeout: 25 seconds
tftp> get test
Transfer timed out.

   出现 Transfer timed out

 

   然后就是怎么测试都不成功!

 


正确的配置方法

 

   1、安装:tftp-hpa,tftpd-hpa,xinetd

mystery@lcw:sudo apt-get install tftp-hpa tftpd-hpa xinetd

 

   2、配置/etc/default/tftpd-hpa

1 # /etc/default/tftpd-hpa
2
3 TFTP_USERNAME="tftp"
4 TFTP_DIRECTORY="/home/mystery/tftp"
5 TFTP_ADDRESS="0.0.0.0:69"
6 TFTP_OPTIONS="--secure -c"

   说明:第二项改成你自己定义的tftp工作目录路径;第四项添加一个“-s”参数以便运行执行put操作(--secure等同于-s; -c等同与--create)

 

   3、设置工作目录/home/mystery/tftp权限

mystery@lcw:~$ sudo chmod -R 777 /home/mystery/tftp
mystery@lcw:~$ sudo chown -R mystery /home/mystery/tftp
mystery@lcw:~$

 

   4、重新启动服务

mystery@lcw:~$ sudo service tftpd-hpa restart
tftpd-hpa stop/waiting
tftpd-hpa start/running, process 5540

 

   5、通过tftp的get和put进行测试

mystery@lcw:~$ tftp localhost
tftp> get test
tftp> put minicom.log
tftp> q
mystery@lcw:~$ ls /home/mystery/tftp/
minicom.log  test
mystery@lcw:~$

   OK,TFTP又开始正常工作,囧……

 

 

posted @ 2013-06-27 17:40  Leo.cheng  阅读(572)  评论(0)    收藏  举报