Tftpd-hpa

安装

使用下面的命令来安置 tftpd-hpa 服务器:

 $ sudo apt-get install tftpd-hpa

注:若server未安装xinetd则在ubuntu9.04中会自动下载openbsd-inetd并安装,使用tftp过程中出错很多时候是因xinetd版本问题;

[编辑] 配置

tftp-hpa 的配置文件为 /etc/default/tftpd-hpa

 RUN_DAEMON="yes" 
 OPTIONS="-l -c -s /tftpboot"    
  1. -c为可创建新文件,若无此参数,put命令则可能出现错误提示,此时只能覆盖原有文件不能创建新文件(I can't create a new file even i  specified the "-c" option);

无论何种方式配置tftp-server -c参数决定是否能正常写入数据;这里指定 tftpd 使用的目录为 /tftpboot,注意要修改目录属性:chmod 777 tftpboot

[编辑] 启动和停止

[编辑] 启动

 # /etc/init.d/tftpd-hpa start

[编辑] 停止

 # /etc/init.d/tftpd-hpa stop

[编辑] 参考

  • http://freshmeat.net/projects/tftp-hpa/
  • http://www.davidsudjiman.info/2006/03/27/installing-and-setting-tftpd-in-ubuntu/

====

http://wiki.ubuntu.org.cn/Tftpd-hpa


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

Installation

A TFTP server is mainly required for booting operating systems orconfigurations over the network. The installation is done by:

# apt-get install tftpd-hpa

Server Configuration

The TFTP server can be started by one of two ways:

  1. directly as daemon, or
  2. via inetd.

In the first case, running as daemon, the linestarting with tftp in /etc/inetd.conf has to becommented (described here for openbsd-inetd or compatible):

Excerpt: /etc/inetd.conf

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

and it has to be enabled in the init script's configuration:

Excerpt: /etc/default/tftpd-hpa

RUN_DAEMON="yes"

In the second case, running via inetd, the linestarting with tftp in /etc/inetd.conf has to beuncommented (for Debian's default inet daemon openbsd-inetd):

Excerpt: /etc/inetd.conf

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

and it has to be disabled in the init script's configuration:

Excerpt: /etc/default/tftpd-hpa

RUN_DAEMON="no"

The root directory from where files can be downloaded by a client defaultsto /var/lib/tftpboot. It can be changed to, e.g., to/new/tftp/root, if required:

Excerpt: /etc/default/tftpd-hpa

OPTIONS="-l -s /new/tftp/root"

Files can be put into this directory and downloaded from a client withoutpassing this root directory in its requests.

Finally, restart openbsd-inetd and tftpd-hpa:

# /etc/init.d/openbsd-inetd restart
# /etc/init.d/tftpd-hpa restart

Server Testing

Put a file foo into the rootdirectory of the TFTP server. Install a TFTP client:

# apt-get install tftp

and download the file (not neccessarily as root):

$ tftp server.example.com
tftp> get foo
tftp> q

The file should now exist into your current working directory.

Networking Requirements

Prerequisite: Shorewall In case of a packetfilter (Shorewall), you will have to permit access from the clients. Thedifficulties resulting from changing source/destination ports in TFTP areautomatically handled by the netfilter NAT/Conntrack helper modules that areloaded by Shorewall by default.

Excerpt: /etc/shorewall/rules

# TFTP
#
ACCEPT		net		$FW		udp	69
#

and restart the packet filter:

# shorewall restart

====

http://chschneider.eu/linux/server/tftpd-hpa.shtml


你可能感兴趣的:(ubuntu)