时间:2011-07-08
环境:Ubuntu10.10 server
1、安装相关软件包:Ubuntu tftp(服务端),tftp(客户端),xinetd
root@xf:/# apt-get install tftpd tftp xinetd
2、建立配置文件
在/etc/xinetd.d/下建立一个配置文件tftp
sudo vim tftp
在文件中输入以下内容:
service tftp
{
socket_type= dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
保存退出。
3、建立Ubuntu tftp服务文件目录(上传文件与下载文件的位置),并且更改其权限
sudo mkdir /tftpboot /*在根目录下建立tftpboot文件夹,注意与mkdir tftpboot的区别*/
sudo chmod 777 /tftpboot –R
4、重新启动服务
sudo /etc/init.d/xinetd restart
至此Ubuntutftp服务已经安装完成了,下面可以对其进行一下测试。(在当前目创建2.c,在tftpboot目录下创建1.c和2.c,且
tftpboot目录下2.c权限为777)
执行get命令时,保证tftpboot目录下的文件权限为777,
执行put命令时,必须先在tftpboot目录下新建一个和上传文件同名的文件且权限为777.
root@xf:/home# tftp 127.0.0.1
tftp> get 1.c
Received 7 bytesin 0.1 seconds
tftp> put 2.c
Sent 10 bytes in0.0 seconds
tftp> quit
5、一些命令
connect connectto remote tftp
mode setfile transfer mode
put sendfile
get receivefile
quit exittftp
verbose toggleverbose mode
trace togglepacket tracing
status showcurrent status
binary setmode to octet
ascii set mode to netascii
rexmt setper-packet retransmission timeout
timeout settotal retransmission timeout
? print helpinformation
原帖:http://blog.chinaunix.net/space.php?uid=25906157&do=blog&id=369865