Vsftpd是一款在Linux发行版中最受欢迎的Ftp服务器程序,特点是小巧轻快,安全易用,Vsftpd也是LXT5架构中Ftp服务器首选软件包。
1. 交叉编译libcap(如果需要!?)
a. 下载:https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.24.tar.gz
tar -zxvf libcap-2.24.tar.gz
cd libcap-2.24
b. 生成libcap/_makenames(x86)
make clean
make
mv ./libcap/_makenames ./libcap/_makenames_x86
c. 修改Make.Rules
...
else
prefix= (指向ARM编译器usr路径)
exec_prefix=$(prefix)
lib_prefix=$(exec_prefix)
inc_prefix=$(prefix)
man_prefix=$(prefix)/share
endif
...
...
CC := arm-arago-linux-gnueabi-gcc
CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
...
d. 修改libcap/Makefile
...
ifeq ($(LIBATTR),yes)
FILES += cap_file
#LDFLAGS += -lattr
#DEPS = -lattr
endif
...
...
cap_names.h: _makenames
./_makenames_x86 > cap_names.h
...
e. 修改libcap/cap_file.c
...
#define XATTR_SECURITY_PREFIX "security."
#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX "capability"
...
f. 交叉编译
make clean
make
make install
2. 交叉编译Vsftpd
a. 解压
tar -zxvf vsftpd-3.0.2.tar.gz
cd vsftpd-3.0.2
b. 修改Makefile
...
CC = arm-arago-linux-gnueabi-gcc
INSTALL = install
...
...
#LIBS = `./vsf_findlibs.sh`
LIBS = -lcap -lpam
LINK = -Wl,-s
...
...
install:
$(INSTALL) -d -m 755 /home/vsftpd/sbin/;
$(INSTALL) -m 755 vsftpd /home/vsftpd/sbin/vsftpd;
clean:
...
c. 交叉编译
make clean
make
make install
d. 配置文件(vsftpd.conf)
anonymous_enable=NO
local_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
chown_uploads=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
async_abor_enable=YES
ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to blah FTP service.
ls_recurse_enable=YES
listen=YES
3. 安装使用(ARMv7硬件系统)
a. 配置文件安装
[email protected]:/home# cp /home/vsftpd/vsftpd.conf /etc
b. 启动vsftpd
[email protected]:/home# mkdir /usr/share/empty
[email protected]:/home# /home/vsftpd/sbin/vsftpd &
c. 添加用户
[email protected]:/home# adduser ftptest
--> passwd: 123456
d. 测试
windows --> cmd --> ftp board_ip ([email protected])
或
浏览器: ftp://board_ip ([email protected])
(作者 冯青华 信庭嵌入式工作室(www.xteda.com)- CEO )
<转载请注名来路>