【教程】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

相关文章
|
27天前
|
Ubuntu Linux Shell
Ubuntu GRUB菜单密码重置教程
本文详细介绍了在Ubuntu 16.04系统中通过GRUB菜单找回密码的方法。包括进入GRUB引导菜单、修改内核参数、重置用户密码及完成重启的完整步骤,帮助用户快速恢复系统访问权限。
198 0
|
2月前
|
Kubernetes 负载均衡 Ubuntu
Kubernetes安装详细教程 Ubuntu版
本教程基于Ubuntu 22.04配置Kubernetes环境,涵盖依赖安装、swap关闭、内核参数调整、containerd与Kubernetes组件安装、集群初始化及CNI网络插件部署等内容,并提供常见问题处理方法和相关工具推荐。
|
1月前
|
Ubuntu Linux 数据安全/隐私保护
一步步学习:Ubuntu系统安装教程
准备完毕,点击“现在安装”,系统开始安装。安装过程中,Ubuntu会显示一些新特性和提示信息。安装完毕后,点击“现在重启”,然后按照提示操作,拔出U盘或DVD盘,再次按下回车,电脑将会再次启动,这次进入的就是全新的Ubuntu操作系统了。 尽管初次安装Ubuntu可能有所困难,但只要跟着步骤走,掌握了规律,就能轻松过关。Ubuntu是个友好且强大的系统,我相信你在探索它的过程中会收获满满。
|
1月前
|
Ubuntu Linux 数据安全/隐私保护
Ubuntu 安装教程(U 盘安装 Ubuntu 详细教程)
完成上述步骤后,Ubuntu将开始安装在你的电脑上。安装完成后,重启电脑,并按提示移除U盘。电脑将自动从硬盘启动进入新装的Ubuntu系统。现在你可以开始探索Ubuntu带来的全新体验了!
|
1月前
|
Ubuntu Linux 数据安全/隐私保护
Ubuntu系统安装详细教程
确认您的选择无误后,安装程序将正式启动。请耐心等待,直至程序运行完毕并提示您重启。随后,您可以安全地移除安装盘,并重启计算机。至此,系统安装已全部完成!
|
1月前
|
Ubuntu Linux 数据安全/隐私保护
Ubuntu 安装教程(U 盘安装 Ubuntu 详细教程)
完成上述步骤后,Ubuntu将开始安装在你的电脑上。安装完成后,重启电脑,并按提示移除U盘。电脑将自动从硬盘启动进入新装的Ubuntu系统。现在你可以开始探索Ubuntu带来的全新体验了!
|
1月前
|
Ubuntu 开发工具
Ubuntu 22.04 aarch64版本操作系统下编译ZLMediaKit教程
通过上述步骤,你可以在Ubuntu 22.04 aarch64版本上成功编译ZLMediaKit,这是一个相对简单而直接的过程,但可能会遇到一些需要根据具体系统环境和要求调整的地方。
367 0
|
3月前
|
存储 缓存 Ubuntu
Ubuntu 20.04修改swap交换空间教程
记得时不时回顾和调整这些设置,来保持你的Ubuntu系统运行得像一只猎豹—迅捷无比。现在,你已经成功地为你的Ubuntu系统完成了大脑扩容手术,让它有了更多的空间去处理更复杂的思维任务。舒服地坐回到你的椅子上,享受更加流畅的电脑体验吧!
134 12
|
3月前
|
Ubuntu Linux 数据安全/隐私保护
Windows中安装WSL 2和Ubuntu系统的教程
回看这一路,有趣吧?你已经跨界成为了一个Windows和Linux的桥梁。期待在代码的世界里,把一切玩得风生水起!
177 13