Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15339236
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类: LINUX

2008-02-28 12:36:00

ubuntu上安装tftp服务器

网线拔掉检测,嵌入式网线直连开发板断电网线拔掉之后,上电仍能自动设置static静态ip地址

luther@gliethttp:~$ sudo apt-get install tftpd-hpa tftp-hpa
luther@gliethttp:~$ mkdir -p /vobs/tftp-dir
luther@gliethttp:~$ chmod a+w /vobs/tftp-dir
luther@gliethttp:~$ sudo vim /etc/xinetd.d/tftp
service tftp
{
    socket_type         = dgram
    protocol            = udp
    wait                = no
    user                = root
    server              = /usr/sbin/in.tftpd
    server_args         = -s /vobs/tftp-dir -c
    disable             = no
    per_source          = 11
    cps                 = 100 2
    flags               = IPv4
}
luther@gliethttp:~$ sudo vim /etc/inetd.conf 注释掉/etc/inetd.conf文件中tftpd启动
#tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
luther@gliethttp:~$ sudo service xinetd restart

==============================================

1、安装server与client
sudo apt-get install tftpd-hpa tftp-hpa

2、删除standalone的启动方式
update-rc.d -f tftpd-hpa remove

3、新建用户tftpd及其主目录
sudo mkdir -p /home/tftpd
sudo useradd -s /bin/false -g nogroup -d /home/tftpd [-p PASSWORD] tftpd
示例:sudo useradd -s /bin/false -g nogroup -d /home/tftpd tftpd
加密码:sudo useradd -s /bin/false -g nogroup -d /home/tftpd tftpd -p 123456

3.5 install xinetd

sudo apt-get install xinetd

4、新建xinetd启动文件
cat /etc/xinetd.d/tftpd
service tftp
{
disable = no
socket_type = dgram
wait = no
user = root
protocol = udp
server = /usr/sbin/in.tftpd
server_args = -s /home/tftpd -p -c -U 077 -u tftpd  #//表示tftp操作目录在/home/tftpd上
log_on_success += PID HOST DURATION
log_on_failure += HOST
}
5、注释掉/etc/inetd.conf文件中tftpd启动
#tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot

5.5 if you have other network connections, such as WiFi, dual-eth cards, pls shutdown the others if tftp is not working.

6、重新启动xinetd服务
sudo /etc/init.d/xinetd restart

(注意:如果相让任何用户都可以上传文件只需要chmod a+w /home/tftpd即可,这样所有人就都可以向tftpd使用put命令上传文件了[luther.gliethttp])

7、测试tftpd服务是否成功
tftp 127.0.0.1
tftp> put 123.log
tftp> put 123.log test.log
tftp> get test.log
tftp> get test.log abc.log
tftp> verbose
Verbose mode on.
tftp> trace
Packet tracing on.
tftp> put kkk.log
sent DATA
received ACK
.........
sent DATA
received ACK
Sent 12999997 bytes in -1.5 seconds [-69987938 bit/s]
++++++++++++++++
注:在哪个目录执行tftp命令,那么上传的文件就是这个目录下的所有文件,下载的文件将只能是server目录下的那些文件!
因为evb板子和liunx下的usb0网卡连接,所以设置usb0网卡地址
ifconfig看看是不是有网卡
然后
sudo ifconfig usb0 192.168.100.1 因为blob默认的地址server地址是192.168.100.1所以需要这样设置才行

ps:
如果发生tftp不能使用,那么 一定是server出现了问题,
在liunx下再执行一次sudo /etc/init.d/xinetd restart就ok了
可以使用tftp localhost测试主机的server是否可以传送数据
阅读(3477) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~