使用下面的命令来安置 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"
无论何种方式配置tftp-server -c参数决定是否能正常写入数据;这里指定 tftpd 使用的目录为 /tftpboot,注意要修改目录属性:chmod 777 tftpboot
# /etc/init.d/tftpd-hpa start
# /etc/init.d/tftpd-hpa stop
====
http://wiki.ubuntu.org.cn/Tftpd-hpa
-------------------------------------------------------
A TFTP server is mainly required for booting operating systems orconfigurations over the network. The installation is done by:
# apt-get install tftpd-hpa
The TFTP server can be started by one of two ways:
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):
/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:
/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
):
/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:
/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:
/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
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.
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.
/etc/shorewall/rules
# TFTP
#
ACCEPT net $FW udp 69
#
and restart the packet filter:
# shorewall restart
====
http://chschneider.eu/linux/server/tftpd-hpa.shtml