【教程】ubuntu中配置tftp

简介:

Preface


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



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


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

1
#sudo apt-get install tftpd tftp xinetd


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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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文件,并更改权限

1
2
3
4
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

      在这之前,先重启下进程

1
mystery@lcw: /etc sudo  reload xinetd

      然后重启服务

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


   5. 测试

1
2
3
4
5
6
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

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


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

1
2
3
4
5
6
# /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权限

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


   4、重新启动服务

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


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

1
2
3
4
5
6
7
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又开始正常工作,囧……




本文转自infohacker 51CTO博客,原文链接:http://blog.51cto.com/liucw/1223695

相关文章
|
2月前
|
网络协议 Java 应用服务中间件
Springboot+ubuntu+Let‘s Encrypt配置https
Springboot+ubuntu+Let‘s Encrypt配置https
33 0
|
2月前
|
Ubuntu
百度搜索:蓝易云【Ubuntu开机自启服务systemd.service配置教程】
现在,你的服务将在Ubuntu开机时自动启动,并在之后的启动中持续运行。记得根据你的实际需求修改 `your_service_name.service`文件中的相关信息。
54 2
|
3月前
|
存储 网络协议 Ubuntu
如何在Ubuntu安装配置SVN服务端并实现无公网ip访问内网资料库
如何在Ubuntu安装配置SVN服务端并实现无公网ip访问内网资料库
69 0
|
3月前
|
Ubuntu 安全 网络安全
百度搜索:蓝易云【Ubuntu系统SSH服务端配置】
现在,你已经成功在Ubuntu系统上配置了SSH服务端。这将允许其他计算机通过SSH协议连接到你的Ubuntu系统,并进行远程管理和操作。请注意,远程访问有安全风险,建议在生产环境中采取必要的安全措施来保护系统。
39 3
|
3月前
|
存储 Ubuntu
百度搜索:蓝易云【在ubuntu系统下安装配置onedrive步骤】
现在,你已经成功在Ubuntu系统下安装和配置了OneDrive,可以使用该工具与OneDrive云端存储进行同步。
40 0
|
3月前
|
Ubuntu
百度搜索:蓝易云【Ubuntu系统新增硬盘,配置自动挂载教程】
现在,您的新硬盘应该已经成功配置为开机自动挂载到 `/mnt/new_disk`目录下了。在每次开机后,Ubuntu会自动将该硬盘挂载到指定的挂载点,您可以在该挂载点下访问和使用新硬盘。
38 0
|
2月前
|
负载均衡 Ubuntu 应用服务中间件
|
16天前
|
Ubuntu 开发工具
Ubuntu vim配置支持鼠标
Ubuntu vim配置支持鼠标
12 0
|
1月前
|
存储 Ubuntu 网络安全
|
3月前
|
Ubuntu Java 数据库
如何在 Ubuntu 22.04 LTS 上安装和配置 OrientDB?
如何在 Ubuntu 22.04 LTS 上安装和配置 OrientDB?
34 1
如何在 Ubuntu 22.04 LTS 上安装和配置 OrientDB?