vsftpdvery secure FTP daemon(非常安全的FTP进程),是一个基于GPL发布的类UNIX类操作系统上运行的服务器的名字(是一种守护进程),可以运行在诸如Linux、BSD、Solaris、HP-UX以及Irix等系统上面。vsftpd支持很多其他传统的FTP服务器不支持的良好特性。使用 vsftpd 可以在 Linux/Unix 系统上搭建一个安全、高性能、稳定性好的轻量级FTP服务器。

现在基于quectel的EC20CEFAG模块,来移植vsftpd服务。

1 下载

下载最新版本源码包,下载地址:https://security.appspot.com/vsftpd.html#download。本文以 vsftpd-3.0.2.tar.gz 版本为例。

如果以上下载地址无法访问,也可以本地下载vsftpd-3.0.2.tar.gz

2 解压

$ mkdir ~/vsftpd
$ cp vsftpd-3.0.2.tar.gz ~/vsftpd
$ cd ~/vsftpd
$ tar xzf vsftpd-3.0.2.tar.gz
$ cd vsftpd-3.0.2/

3 配置

修改Makefile文件:

CC = arm-oe-linux-gnueabi-gcc

4 设置交叉编译环境&编译

$ source ../../ql-ol-crosstool/ql-ol-crosstool-env-init

$ make

  1. sysdeputil.o:sysdeputil.c:function vsf_sysdep_has_capabilities: error: undefined reference to 'cap_get_proc'
  2. sysdeputil.o:sysdeputil.c:function vsf_sysdep_has_capabilities: error: undefined reference to 'cap_free'
  3. sysdeputil.o:sysdeputil.c:function vsf_sysdep_adopt_capabilities: error: undefined reference to 'cap_init'
  4. sysdeputil.o:sysdeputil.c:function vsf_sysdep_adopt_capabilities: error: undefined reference to 'cap_set_proc'
  5. sysdeputil.o:sysdeputil.c:function vsf_sysdep_adopt_capabilities: error: undefined reference to 'cap_free'
  6. sysdeputil.o:sysdeputil.c:function vsf_sysdep_adopt_capabilities: error: undefined reference to 'cap_set_flag'
  7. sysdeputil.o:sysdeputil.c:function vsf_sysdep_adopt_capabilities: error: undefined reference to 'cap_set_flag'
  8. sysdeputil.o:sysdeputil.c:function vsf_sysdep_adopt_capabilities: error: undefined reference to 'cap_set_flag'
  9. sysdeputil.o:sysdeputil.c:function vsf_sysdep_adopt_capabilities: error: undefined reference to 'cap_set_flag'
  10. collect2: error: ld returned exit status
  11. Makefile:: recipe for target 'vsftpd' failed
  12. make: *** [vsftpd] Error

编译报错,修改Makefile文件,在CC 后面添加“ -lcap ”

  1. 27 .c.o:
  2. $(CC) -c $*.c $(CFLAGS) $(IFLAGS) -lcap
  3. #$(CC) -c $*.c $(CFLAGS) $(IFLAGS)
  4.  
  5. vsftpd: $(OBJS)
  6. $(CC) -o vsftpd $(OBJS) $(LINK) $(LDFLAGS) $(LIBS) -lcap
  7. #$(CC) -o vsftpd $(OBJS) $(LINK) $(LDFLAGS) $(LIBS)

make 后,当前目录下会生成两个文件:vsftpdvsftpd.conf,这两个文件是我们要用的。

5 复制文件

将生成的 vsftpd 复制到目标板 /usr/sbin 目录,vsftpd.conf 复制到目标板 /etc 目录,并添加 vsftpd 为可执行:

$ cp vsftpd ql-ol-sdk/ql-ol-rootfs/usr/sbin                       # 复制执行文件到目标板
$ cp vsftpd.conf ql-ol-sdk/ql-ol-rootfs/etc/                      # 复制配置文件到目标板
$ chmod +x ql-ol-sdk/ql-ol-rootfs/usr/sbin/vsftpd                 # 添加可执行权限

6 配置

使用 vi 打开 vsftpd.conf 文件,并进行配置,如下配置可实现正常上传下载功能:(这段可以随便改)

# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
# 允许登录的FTP用户写权限,还要视目录的权限而定
write_enable=YES

pam_service_name=vsftpd
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
anon_umask=0000
file_open_mode=0777
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# 允许匿名用户上传文件
anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
# 允许匿名用户创建目录
anon_mkdir_write_enable=YES
# 允许匿名用户进行删除或者改名等操作
anon_other_write_enable=YES
# 指定匿名用户登录后的主目录为/data/software目录
#anon_root=/data/software
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to LSDDM-AMR1808-B4 FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES
# 指定匿名用户,默认为ftp
ftp_username=ftp

$ adduser nobody                    # vsftpd默认配置需要
$ mkdir  ql-ol-sdk/ql-ol-rootfs/usr/share/empty            # vsftpd默认配置需要

再在目标版上使用命令配置:

创建一个本地用户,并设置密码:

$ adduser root
Changing password for root
New password:
Retype password:
Password for ftpadmin changed by root

7 打开vsftp

配置完之后,在目标板上打开vsftp,命令:

# /usr/sbin/vsftpd &

注意,后面还有一个 &。如果要让 vsftpd 开机启动,可以将该命令添加到 /etc/profile 或者 rc.local 文件最后。

8 客户端测试

  1. C:\Users\ricks>ftp
  2. ftp> open 192.168.31.45
  3. 连接到 192.168.31.45
  4. Welcome to EC20 FTP service.
  5. Always in UTF8 mode.
  6. 用户(192.168.31.45:(none)): root
  7. Please specify the password.
  8. 密码:
  9. Login successful.

待续。。。

移植vsftpd到arm linux的更多相关文章

  1. 【转】移植vsftpd到arm linux

    vsftpd即very secure FTP daemon(非常安全的FTP进程),是一个基于GPL发布的类UNIX类操作系统上运行的服务器的名字(是一种守护进程),可以运行在诸如Linux.BSD. ...

  2. 成功移植SQLite3到ARM Linux开发板

    SQLite,是一款轻型的数据库,是遵守ACID的关联式数据库管理系统,它的设计目标是嵌入式的,而且目前已经在很多嵌入式产品中使用了它,它占用资源非常的低,在嵌入式设备中,可能只需要几百K的内存就够了 ...

  3. 移植openssh到arm linux

    一.在移植之前需要准备做一些前期准备: 1.移植zlib库 1.1获取zlib源码 1.2解压 tar xvf zlib-1.2.11.tar.xz 1.3交叉编译 1.3.1 指定交叉编译器 exp ...

  4. arm linux 移植 x265

    背景 本来想着把 x265编译到ffmpeg里面,搞定了x265的编译:但是一直报ERROR: x265 not found using pkg-config这个错误,我按照网上的资料,查看了ffbu ...

  5. 移植ARM linux下远程连接工具dropbear

    移植ARM linux下远程连接工具dropbear 原文地址:http://www.cnblogs.com/NickQ/p/9010529.html 移植zlib 下载地址:https://gith ...

  6. Linux 安装 go 以及 arm linux 移植 go

    背景 Go是一门全新的静态类型开发语言,具有自动垃圾回收,丰富的内置类型,函数多返回值,错误处理,匿名函数,并发编程,反射等特性. 从Go1.4之后Go语言的编译器完全由Go语言编写,所以为了从源代码 ...

  7. ARM Linux Qt 5.x.x 无标题栏

    /********************************************************************************* * ARM Linux Qt 5. ...

  8. ARM Linux从Bootloader、kernel到filesystem启动流程

    转自:http://www.veryarm.com/1491.html ARM Linux启动流程大致为:bootloader ---->kernel---->root filesyste ...

  9. 009-2010网络最热的 嵌入式学习|ARM|Linux|wince|ucos|经典资料与实例分析

    前段时间做了一个关于ARM9 2440资料的汇总帖,很高兴看到21ic和CSDN等论坛朋友们的支持和鼓励.当年学单片机的时候datasheet和学习资料基本都是在论坛上找到的,也遇到很多好心的高手朋友 ...

随机推荐

  1. #define vs. const vs enum

    In one word, using const is better than define. enum is the best. There are lots of discussions. I p ...

  2. Go语言实战 (William,Kennedy 等著)

    第1章 关于Go语言的介绍 (已看) 1.1 用Go解决现代编程难题 1.1.1 开发速度 1.1.2 并发 1. goroutine 2. 通道 1.1.3 Go语言的类型系统 1. 类型简单 2. ...

  3. MySQL聚合函数与数据分组

    我们最常需要的是汇总数据而不是把他们实际检索出来 确定表中行数(或满足某个条件或包含某个特定值的行数) 确定表中行组的和 找出表列(或所有行或特定列)的最大值,最小值和平均值 聚集函数是运行在行组上, ...

  4. KiCad 的 Digikey 元件库

    KiCad 的 Digikey 元件库 KiCad 最初由法国人Jean-Pierre Charras于1992年推出,目前由 CERN(欧洲核子研究组织)接手开发. 而且现在有很多大公司的加入,比如 ...

  5. [转]B树(多向平衡查找树)详解

    B-树是对2-3树数据结构的扩展.它支持对保存在磁盘或者网络上的符号表进行外部查找,这些文件可能比我们以前考虑的输入要大的多(以前的输入能够保存在内存中). (B树和B+树是实现数据库的数据结构,一般 ...

  6. 逻辑回归原理(python代码实现)

    Logistic Regression Classifier逻辑回归主要思想就是用最大似然概率方法构建出方程,为最大化方程,利用牛顿梯度上升求解方程参数. 优点:计算代价不高,易于理解和实现. 缺点: ...

  7. Python3:sorted()函数及列表中的sort()函数

    一.sort,sorted函数介绍:   Sort函数是list列表中的函数,而sorted可以对list或者iterator进行排序.   下面我们使用help来查看他们的用法及功能: sort: ...

  8. ELK-head

    Head从elastic5开始只是支持单独服务器,不能够在通过 elasticsearch/bin/plugin -install mobz/elasticsearch-head 这样简单的方式安装插 ...

  9. java 迭代

    迭代器的作用是提供一种方法对一个容器对象中的各个元素进行访问,而又不暴露该对象容器的内部细节. java中的很多容器都实现了Iterable接口,容器中的元素都是可以遍历的. 如下例,list容器中存 ...

  10. Redis set数据结构

    set里的数据不能重复 1. 增加set1,值为 a b c d 1 2 3 2. 返回集合元素的数量 3. 重命名set1为set100 4. 查看集合中的成员 5.sdiff set100 set ...