debian开发环境:tftp服务

使用debian作为开发服务器,需要用到tftp服务。安装配置笔记如下:

安装:
apt-get install xinetd  tftpd tftp

提示没有tftpd,使用命令debian:xinetd.d# apt-get install tftpd*
来安装tftpd,自动安装的是tftpd-hpa。

正在读取软件包列表... 完成
正在分析软件包的依赖关系树      
正在读取状态信息... 完成      
注意,根据正则表达式“tftpd*”选中了 tftpd-hpa
注意,根据正则表达式“tftpd*”选中了 tftpd
注意,根据正则表达式“tftpd*”选中了 tftp
注意,根据正则表达式“tftpd*”选中了 atftpd
将会安装下列额外的软件包:
  tftpd-hpa
下列【新】软件包将被安装:
  tftpd-hpa
共升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
需要下载 0B/34.6kB 的软件包。
解压缩后会消耗掉 98.3kB 的额外空间。
您希望继续执行吗?[Y/n]y
正在预设定软件包 ...
选中了曾被取消选择的软件包 tftpd-hpa。
(正在读取数据库 ... 系统当前总共安装有 97571 个文件和目录。)
正在解压缩 tftpd-hpa (从 .../tftpd-hpa_0.48-2.3_i386.deb) ...
正在处理用于 man-db 的触发器...
正在设置 tftpd-hpa (0.48-2.3) ...
--------- IMPORTANT INFORMATION FOR XINETD USERS ----------
The following line will be added to your /etc/inetd.conf file:

tftp           dgram   udp     wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

If you are indeed using xinetd, you will have to convert the
above into /etc/xinetd.conf format, and add it manually. See
/usr/share/doc/xinetd/README.Debian for more information.
Suggested entry (automatically converted using itox):

service tftp
{
 socket_type     = dgram
 protocol        = udp
 wait            = yes
 user            = root
 server          = /usr/sbin/in.tftpd
 server_args     = -s /var/lib/tftpboot
}

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

tftpd-hpa disabled in /etc/default/tftpd-hpa
debian:xinetd.d#

百度一下inetd 和xinetd:
每个 UNIX 管理员都熟悉 inetd,inetd 是一个守护程序,通过一个集中的配置文件(inetd.conf)来管理大多数入网连接。xinetd 守护程序是 inetd 的替代,它提供许多改进的或新的特性,以及更容易的配置。Ted 解释了 inetd 背后的概念,并且给出了在您自己的站点上设置 xinetd 的示例。
经典的 inetd 守护程序已经存在很久了。有几种替换 inetd 的功能的方法,但是最灵活、最简便的方法似乎是 xinetd。inetd 能做的,xinetd 也能做,并且 xinetd 还能做更多的事情。譬如,TCP 封装、模块化配置、连接重定向和入站连接的负载限制,而这些只是使得 xinetd 成为系统管理员良好选择的部分特性。

OK,那我们就用xinetd。
根据提示,将/etc/inetd.conf 的tftp配置删掉。
将下面的内容保存在文件tftp里,放到/etc/xinetd.d/下面。

# description: The tftp server serves files using the trivial file transfer /
# protocol.  The tftp protocol is often used to boot diskless /
# workstations, download configuration files to network-aware printers, /
# and to start the installation process for some operating systems.
service tftp
{
 socket_type  = dgram
 protocol  = udp
 wait   = yes
 user   = root
 server   = /usr/sbin/in.tftpd
 server_args  = -s /tftpboot    //这个是修改过的,你的tftpboot目录是啥,就写啥在这里,注意此目录应该是可读写的权限。不然测试时会报错:Error code 0: Permission denied
}

然后重新启动xinetd服务:
/etc/init.d/xinetd reload  
或者
/etc/init.d/xinetd restart 

测试tftp服务:放一个文件test 在/tftpboot下面。
在debian服务器本机上测试(本机ip 192.168.10.74):
tftp 192.168.10.74
tftp> get abc
Received 66 bytes in 0.0 seconds

当使用tftp> put abc的时候,常常提示Error code 1: File not found,
需要在tftpboot里面先touch一个空的文件,名字叫做abc,在使用 put,才可以ok。WHy?????

tftp> put abc
Sent 29 bytes in 0.0 seconds

tftp> q


在windows下也可以测试:
Transfers files to and from a remote computer running the TFTP service.

TFTP [-i] host [GET | PUT] source [destination]

  -i              Specifies binary image transfer mode (also called
                  octet). In binary image mode the file is moved
                  literally, byte by byte. Use this mode when
                  transferring binary files.
  host            Specifies the local or remote host.
  GET             Transfers the file destination on the remote host to
                  the file source on the local host.
  PUT             Transfers the file source on the local host to
                  the file destination on the remote host.
  source          Specifies the file to transfer.
  destination     Specifies where to transfer the file.

C:/Documents and Settings/Administrator>tftp -i 192.168.10.102 GET abc
Transfer successful: 66 bytes in 1 second, 66 bytes/s

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值