TFTP Trivial File Transfer Protocol

DESCRIPTION
tftpd is a server for the IPv4 Trivial File Transfer Protocol. The
TFTP protocol is extensively used to support remote booting of diskless
devices. The server is normally started by inetd(xinetd), but can also run
standalone.

此服務在一般使用時,是不需驗證使用者的,故請小心安全性,不使用時需將之關閉,directory權限也要注意。

安裝tftp

in Red Hat 9

我使用的是tftp-server-0.28-2.i386.rpm

#rpm -ivh tftp-server-0.28-2.i386.rpm

設定tftp

#vi /etc/xinetd.d/tftp

 

service tftp
{
disable = no
#預設disable = yes,設成no才服務
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -c -s /tftpboot
#預設只有 server_args = -s /tftproot 但要 -c 才可Allow new files to be created.(見man tftpd)
per_source = 11
cps = 100 2
}

更改directory權限

#chmod 777 /tftproot
將tftp directory 之權限改為777,才能讓anybody讀寫此directory。

 

重要參數

#man tftpd

OPTIONS
-l Run the server in standalone (listen) mode, rather than run from
inetd. In listen mode, the -t option is ignored, and the -a
option can be used to specify a specific local address or port
to listen to.

-a [address][:port]
Specify a specific address and port to listen to when called
with the -l option. The default is to listen to the tftp port
specified in /etc/services on all local addresses.

-c Allow new files to be created. By default, tftpd will only
allow upload of files that already exist. Files are created
with default permissions allowing anyone to read or write them,
unless the -p or -U options are specified.

-s Change root directory on startup. This means the remote host
does not need to pass along the directory as part of the trans-
fer, and may add security. When -s is specified, exactly one
directory should be specified on the command line. The use of
this option is recommended for security as well as compatibility
with some boot ROMs which cannot be easily made to include a
directory name in its request.

啟動tftp

started by xinetd:

/etc/init.d/xinetd restart

run standalone


 

使用

在Win2000 command下為例:

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

D:>tftp hostname put 1.txt
將本機上的1.txt放在hostname上的tftp directory。

D:>tftp hostname get 1.txt
將hostname上的tftp directory中之1.txt取回本機。

 

back