跳转至

用 tftpd-hpa 支持有缺陷的 TFTP 客户端

通过使用重映射文件,可以很容易地把 tftpd-hpa 配置为支持有缺陷的 TFTP 客户端。你可以输入以下命令来验证你的 TFTP 服务器是否支持重映射文件:

  /usr/sbin/in.tftpd -V

你应该会看到类似以下的输出:

  tftp-hpa 0.40, with remap, with tcpwrappers

如果没有 "with remap" 字样,那么你需要先重新构建支持重映射的 TFTP 服务器,然后再继续。

创建文件 /etc/tftpd.map,内容如下:

  # Convert backslashes to slashes
  rg \\ /

编辑 /etc/xinetd.d/tftp,在 server_args 行追加:

  -m /etc/tftpd.map

你修改后的 /etc/xinetd.d/tftp 文件应该类似这样:

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

结束所有现有的 tftpd 进程并重启 xinetd:

  killall tftpd
  killall in.tftpd
  /etc/init.d/xinetd restart

TFTP 服务器现在应该可以接受使用通常的正斜杠(/)或反斜杠(\)作为路径分隔符的路径。

A smile