浅析busybox内置的ftpd服务程序如何配置
server服务器配置
方法1:
# mkdir /gliethttp_ftpd_dir
# cp /bin/busybox /gliethttp_ftpd_dir
# tcpsvd 0 21 ftpd -w /gliethttp_ftpd_dir &
// 上面的0表示对所有ip地址都进行侦听
// 如果设置为127.0.0.1那么只能开发板本地arm可以进行ftp
// 比如开发板eth0的的ip地址设为172.20.0.2,那么就不能通过该ip登录
// 所以上面指定ip等于0,那么无论来自127.0.0.1还是172.20.0.2网络地址的
// 数据都能使用ftpd服务器.
// ftpd -w这里的参数-w表示client可以对目录执行写操作
// 可以使用-t和-T参数设置client在没有任何操作的最大时间之后ftpd主动断开client连接,即:Idle and absolute timeouts
// 默认-t为2分钟=2 * 60,-T为1小时=1 * 60 * 60
方法2:
# mkdir /gliethttp_ftpd_dir
# cp /bin/busybox /gliethttp_ftpd_dir
# vi /etc/inetd.conf
21 stream tcp nowait root ftpd ftpd -w /gliethttp_ftpd_dir
# inetd // inetd会执行/etc/inetd.conf脚本中的命令行,这样ftpd就作为daemon运行到起来了
(注意:以上2种方式运行的ftpd都不会在ps中看到ftpd进程的运行)
//========================================================
client客户端测试
在pc机上直接ftp数据
luther@gliethttp:~$ ftp 172.20.0.2
Connected to 172.20.0.2.
220 Operation successful
Name (172.20.0.2:luther):
230 Operation successful
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 Operation successful
150 Directory listing
-rwxr-xr-x 1 0 0 826724 Jan 1 00:02 busybox
226 Operation successful
ftp> put uda1341ts.tar.bz2 // 将uda1341ts.tar.bz2文件上传到开发板的/gliethttp_ftpd_dir目录下
local: uda1341ts.tar.bz2 remote: uda1341ts.tar.bz2
200 Operation successful
150 Ok to send data
226 Operation successful
485435 bytes sent in 0.12 secs (3809.5 kB/s)
ftp> ls
200 Operation successful
150 Directory listing
-rwxr-xr-x 1 0 0 826724 Jan 1 00:02 busybox
-rw-r--r-- 1 0 0 485435 Jan 1 00:03 uda1341ts.tar.bz2 // 刚刚上传上上去的uda1341ts.tar.bz2文件
226 Operation successful
ftp> get busybox
local: busybox remote: busybox
200 Operation successful
150 Opening BINARY connection for busybox (826724 bytes)
226 Operation successful
826724 bytes received in 0.15 secs (5411.8 kB/s)
ftp> del busybox
250 Operation successful
ftp> ls
200 Operation successful
150 Directory listing
-rw-r--r-- 1 0 0 485435 Jan 1 00:03 uda1341ts.tar.bz2
226 Operation successful
ftp>
在pc机上telnet到开发板
luther@gliethttp:~$ telnet 172.20.0.2
Trying 172.20.0.2...
Connected to 172.20.0.2.
Escape character is '^]'.
172.20.0.2 login: root
# cd /mnt/
# ftpget 127.0.0.1 busybox_bin /busybox
# ls
busybox_bin
# chmod +x busybox_bin
# ./busybox_bin
BusyBox v1.14.3 (2009-08-10 10:13:59 UTC) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.
阅读(1446) | 评论(0) | 转发(0) |