在fc6上搭tftpd

公司的开发环境依然停留在fc6上,,,,对..很旧,旧到想死.

 

我在没有进一步熟悉ubuntu的基础上,为了保持ABI一致.

只能依旧在FC6 上开发.

 

可是现在发现开发完成,我要在fc6上文件到win7,再win7 winscp过去arm板,,,,,,痛啊.

想了老半天,问了一下同事,他说可以在win7上开个tftpd我想了一下,能不能再省一点功夫,

直接在fc6上开一个.

如果..我FC6可以上网可以用yum之类,就秒搞定,

可是不行.

于是我只好四处找tftpd的安装方法.

经过在kenel中找到tftpd 的src之后,还是发现需要xinet.....

之后一系列的设置,

看来那个用src

configure

make

make install

的办法于我不行.

于是我就进行了rpm包的查找,,之后,发现FC21的版本太新了.不行,

于是我就找回了

FC6的xinetd

及tftpd

之后就是按顺序安装,再

2,修改/etc/xinetd.d/tftp文件,把disable前面加一个#
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
# disable = yes
per_source = 11
cps = 100 2
flags = IPv4
}

 

由于之前的防火墙已关掉,

cd /

mkdir tftpboot

chmod 777 -R /tftpboot/

 

service xinetd restart

搞定.

---------------后来发现

发现想回传文件的时候,不能写入

查了一下,tftpd一般来说可以读文件,写文件,但写入的文件必须存在,如不存在就写入(也就是相当于创建的话)需要修改

也就是上面的配置改成

server_args = -c -s /tftpboot

再运行chmod -R 777 /tftpboot

再service xinetd restart

tftpd启动的参数.

转下文

 http://blog.chinaunix.net/uid-26939498-id-3801710.html

 

TFTP(Trivial File Transfer Protocol,简单文件传输协议)是TCP/IP协议族中的一个用来在客户机与服务器之间进行文件传输的简单协议,主要基于UDP协议来实现。该协议最初设计的目的是进行小文件的传输,因此它不具备通常的FTP的许多功能,它只能从TFTP服务器上获得或入文件,不能列出目录,不进行认证。
1.tftp的配置文件
[root@localhost Desktop]# gedit /etc/xinetd.d/tftp
1    # default: off
 2    # description: The tftp server serves files using t he trivial file transfer \
 3    #    protocol.  The tftp protocol is often used to boot diskless \
 4    #    workstations, download configuration files to network-aware printers, \
 5    #    and to start the installation process for some operating systems.
 6    service tftp
 7    {
 8        socket_type        = dgram
 9        protocol        = udp
10        wait            = yes
11        user            = root
12        server            = /usr/sbin/in.tftpd
13        server_args        = -s /tftpboot
14        disable        = no
15        per_source        = 11
16        cps            = 100 2
17        flags            = IPv4
18    }
其中,server_args = -s /tftpboot是tftp服务器运行时的参数。-s /tftpboot表示服务器默认的目录是/tftpboot,当执行put a.txt命令时,文件被放到服务器的路径是/tftpboot/a.txt。
可以执行tftp、get命令下载文件。在嵌入式开发中,多使用下载功能。
可以执行put命令上传文件。上传文件时,需要先把服务器上的/tftpboot目录和这个目录下的文件变成可读可权限,可以执行如下命令:
[root@localhost Desktop]# chmod -R 666 /tftpboot
默认情况下,只能上传tftp服务器已经存在的文件,例如,在tftp服务器上有/tftpboot/a.txt这个文件,可以执行如下命令:
[root@localhost Desktop]# put a.txt
如果想上传tftp服务器目录中没有的文件,需要修改tftp服务器的配置文件,
将/etc/xinetd.d/tftp文件的第13行改为“server_args = -s /tftpboot -c”即可,然后重启tftp服务器。
2.重启tftp服务器
[root@localhost Desktop]# service xinetd restart
停止 xinetd:                                              [确定]
启动 xinetd:                                              [确定]
[root@localhost Desktop]# 
3.测试tftp
[root@localhost Desktop]# netstat -a|grep tftp
udp        0      0 *:tftp                      *:*                                     
[root@localhost Desktop]# netstat -an|grep 69|grep udp
udp        0      0 0.0.0.0:69                  0.0.0.0:*
udp        0      0 :::56996                    :::*                                    
执行上面两条命令中的任何一条,如果有相关的输出,就表明tftp服务器配置成功。
注:tftp服务器使用UDP协议,使用的端口号是69。

 

posted on 2014-03-20 17:08  Orz..  阅读(281)  评论(0编辑  收藏  举报

导航