vsftpd-2.3.4服务器在ok6410开发板上的移植_.text+0xdf0-程序员宅基地

技术标签: reference  ftp服务器  file  upload  asynchronous  服务器  移植  嵌入式开发  

老房原创修改版,在房老师教程基础上修改而成。

 

老房原创,转载声明,熬夜至凌晨2点捣鼓不容易啊!
我的环境飞凌OK6410开发板,arm-linux-gcc 4.3.2(我一般用的开发工具不新不旧)
--------------------------------------
------线-------------------------------------------------
1
下载
Ubuntu
上的ftp客户端软件filezilla
安装:
sudoapt-get installfilezilla

安装完成后,在应用程序->互联网会看到
采用ftp客户端filezilla下载:ftp://vsftpd.beasts.org/users/cevans/untar/下载vsftpd-2.3.4
2
修改Makefile文件
CC=arm-linux-gcc
3
执行make
若出现错误------------------------------------------
/bin/sh:./vsf_findlibs.sh: Permission denied
sysdeputil.o: In function`vsf_sysdep_check_auth':
sysdeputil.c:(.text+0xdcc): undefinedreference to `crypt'
sysdeputil.c:(.text+0xdf0): undefinedreference to `crypt'
collect2: ld returned 1 exit status
make:*** [vsftpd]
错误1
修改./vsf_findlibs.sh属性为可读写与执行
-------------------------------------------------------------
/lib/libcap.so.2:could not read symbols: File in wrong format
collect2: ld returned1 exit status
make: *** [vsftpd]
错误1
修改vsffindlibs.sh
屏蔽掉49-57行;

------------------------------------------------------------------------

如果之后再出现


sysdeputil.o:In function `vsf_sysdep_check_auth':
sysdeputil.c:(.text+0xdcc):undefined reference to `crypt'
sysdeputil.c:(.text+0xdf0):undefined reference to `crypt'
collect2: ld returned 1 exitstatus
make: *** [vsftpd]
错误 1


那么就把/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/lib/下的libcrypt.so.1复制到开发板根文件系统/lib目录下

至于为什么这么处理我也想不明白。


4
执行arm-linux-readelf-d vsftpd显示需要哪些库,如下:
Dynamicsection at offset 0x170fc contains 29 entries:
  Tag        Type                        Name/Value
0x00000001 (NEEDED)                    Shared library: [libcrypt.so.1]

0x00000001(NEEDED)                     Shared library: [libc.so.6]

0x0000000c(INIT)                       0x9680

0x0000000d(FINI)                       0x1b3f4

0x00000019(INIT_ARRAY)                 0x26a58

0x0000001b(INIT_ARRAYSZ)               4 (bytes)

0x0000001a(FINI_ARRAY)                 0x26a5c

0x0000001c(FINI_ARRAYSZ)               4 (bytes)

0x00000004(HASH)                       0x8168

0x00000005(STRTAB)                     0x8d08

0x00000006(SYMTAB)                     0x84f8

0x0000000a(STRSZ)                      1100 (bytes)

0x0000000b(SYMENT)                     16 (bytes)

0x00000015(DEBUG)                      0x0

0x00000003(PLTGOT)                     0x26b54

0x00000002(PLTRELSZ)                   984 (bytes)

0x00000014(PLTREL)                     REL

0x00000017(JMPREL)                     0x92a8

0x00000011(REL)                        0x9298

0x00000012(RELSZ)                      16 (bytes)

0x00000013(RELENT)                     8 (bytes)

0x6ffffffe(VERNEED)                    0x9258

0x6fffffff(VERNEEDNUM)                 2

0x6ffffff0(VERSYM)                     0x9154

0x00000000(NULL)                       0x0
libcrypt.so.1l libc.so.6 及这两个连接所指向的源文件用cp-a 复制到根文件系统的/lib

另外还有libnss_files.so.2及该连接所指向的源文件, 否则运行时会出现:
500OOPS: vsftpd: cannot locate user specified in'ftp_username':ftp
错误;(这点错误弄了一晚上好几个小时)ps:好帅老师辛苦了


5
把生成的vsftpd拷贝到根文件系统的sbin目录,vsftpd.conf文件拷贝到根文件系统的etc目录下
6
配置vsftpd.conf
对配置文件进行了修改,我的:
#Example config file /etc/vsftpd.conf
#
# The default compiledin settings are fairly paranoid. This sample file
# loosens thingsup a bit, to make the ftp daemon more usable.
# Please seevsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: Thisexample file is NOT an exhaustive list of vsftpd options.
# Pleaseread the vsftpd.conf.5 manual page to get a full idea of vsftpd's
#capabilities.
#
# Allow anonymous FTP? (Beware - allowed bydefault 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 writecommand.
write_enable=YES
#
# Default umask for local usersis 077. You may wish to change this to 022,
# if your users expectthat (022 is used by most other ftpd's)
#local_umask=022
#
#Uncomment this to allow the anonymous FTP user to upload files. Thisonly
# has an effect if the above global write enable isactivated. Also, you will
# obviously need to create a directorywritable by the FTP user.
anon_upload_enable=YES
#
#Uncomment this if you want the anonymous FTP user to be able tocreate
# new directories.
anon_mkdir_write_enable=YES
#
#Activate directory messages - messages given to remote users whenthey
# 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, youcan arrange for uploaded anonymous files to be owned by
# adifferent user. Note! Using "root" for uploaded files isnot
# recommended!

#chown_uploads用户指定anonymous帐号上传的文件是否要改变其所有者,默认为NO,chown_username用来指定新的所有者
#在FTP服务器中,匿名用户的用户名和密码都是ftp

chown_uploads=YES
chown_username=ftp
#
#You may override where the log file goes if you like. The default isshown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# Ifyou want, you can have your log file in standard ftpd xferlogformat
xferlog_std_format=YES
#
# You may change the defaultvalue for timing out an idle session.
#idle_session_timeout=600
#
#You may change the default value for timing out a dataconnection.
#data_connection_timeout=120
#
# It isrecommended that you define on your system a unique user which the
#ftp server can use as a totally isolated and unprivilegeduser.
nopriv_user=ftp
#
# Enable this and the server willrecognise asynchronous ABOR requests. Not
# recommended forsecurity (the code is non-trivial). Not enabling it,
# however,may confuse older FTP clients.
async_abor_enable=YES
#
# Bydefault the server will pretend to allow ASCII mode but in factignore
# the request. Turn on the below options to have the serveractually do ASCII
# mangling on files when in ASCII mode.
#Beware that on some FTP servers, ASCII support allows a denial ofservice
# attack (DoS) via the command "SIZE /big/file"in ASCII mode. vsftpd
# predicted this attack and has always beensafe, reporting the size of the
# raw file.
# ASCII mangling isa horrible feature of theprotocol.
ascii_upload_enable=YES
ascii_download_enable=YES
#
#You may fully customise the login banner string:
ftpd_banner=Welcometo blah FTP service.
#
# You may specify a file of disallowedanonymous e-mail addresses. Apparently
# useful for combattingcertain DoS attacks.
#deny_email_enable=YES
# (defaultfollows)
#banned_email_file=/etc/vsftpd.banned_emails
#
#You may specify an explicit list of local users to chroot() to theirhome
# directory. If chroot_local_user is YES, then this listbecomes a list of
# users to NOTchroot().
#chroot_list_enable=YES
# (defaultfollows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# Youmay activate the "-R" option to the builtin ls. This isdisabled by
# default to avoid remote users being able to causeexcessive I/O on large
# sites. However, some broken FTP clientssuch as "ncftp" and "mirror" assume
# thepresence of the "-R" option, so there is a strong case forenablingit.
ls_recurse_enable=YES


#使vsftpd处于独立启动模式

listen=YES


listen_port=21
anon_other_write_enable=YES
7
开发板根文件系统创建必要的目录:
mkdir-p /var/ftp/pub
mkdir -p /usr/share/empty
chown root:root/var/ftp
chmod 755 /var/ftp
cd /var/ftp
chmod 777 pub


说明:


pub这个目录是用来供匿名用户上传文件的,上传的文件存放在此处,故其属性为777,而其他目录无此属性,不能用来作为上传目录。


8
创建用户
/etc/group
文件至少要有root:
root:*:0:
/etc/passwd
文件增加ftpnobody用户:
root::0:0:root:/:/bin/sh
ftp::14:50:FTPUser:/var/ftp:
nobody:*:99:99:Nobody:/:


说明:

root:*:0:

root是用户组名称,*是密码字段,0GID


root::0:0:root:/:/bin/sh

root是用户名;

后面冒号之间的空白是密码字段,这里是空;

后面两个0分别是UIDGID

再后面分别指定了root的家目录为/和要登录的shell/bin/bash


ftp::14:50:FTPUser:/var/ftp:


ftp是用户名;
冒号之间是密码字段,是隐藏的;

14
是用户的UID字段,可以自己来设定,不要和其它用户的UID相同,否则会造成系统安全问题;

50
用用户组的GID,可以自己设定,不要和其它用户组共用FTPGID,否则会造成系统全全问题;FTPUser是用户说明字段,可以随意取名;

/var/ftp
ftp用户的家目录,可以自己来定义;

后面的shell字段为空,应该是不能登录shell

(如果 shell 字段设置为 /sbin/nologin 表示该用户不能登录系统,系统虚拟帐号(也被称为伪用户)一般都是这么设置。如果我们把 ftp 用户的 /sbin/nologin改为/bin/bash,这样ftp 用户通过本地或者远程工具ssh telnet 以真实用户身份登录到系统。这样做对系统来说是不安全的)


9.
开发板执行vsftpd/etc/vsftpd.conf&启动ftp,输入帐号名和密码即登入;
用户名root密码空,可访问开发板任意目录;
用户名anonymous密码空,可访问/var/ftp/pub目录

用户名ftp密码空,可访问/var/ftp/pub目录


说明:

(摘自网络)

当我们访问各大FTP上访问时,可能我们不去想我们以什么身份登录的,如果他的FTP允许匿名登录的话;比如我们在浏览器上打入;

ftp://mirrors.kernel.org

ftp://ftp:[email protected]


我们会发现上面的两行最终都能访问,而且显示的结果也完全一样,最终都跳到ftp://mirrors.kernel.org地址;那我们访问这个FTP时,是不是有用户和密码呢?是的,也是需要在的,只是在服务器端允许匿名访问,而匿名访问的用户名和密码都是ftp,只是我们因为匿名访问,没有感觉到他有用户名和密码罢了。第二个地址就是以ftp用户,密码也是ftp来访问ftp://mirrors.kernel.org

如果我们以ftp命令连接mirrors.kernel.org时,我们会发现需要输入用户ftp,密码ftp才能访问;

FTP服务器中,匿名用户的用户名和密码都是ftp;这个用户可以在您的操作系统中的/etc/passwd中能找得到。


可采用最先开始安装的filezilla测试!!


参考资料:

http://www.linuxsir.org/main/node/152


http://apps.hi.baidu.com/share/detail/50310481


http://blog.sina.com.cn/s/blog_498719980100092k.html


以及老房原创原文:

http://user.qzone.qq.com/117482672#!


版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/alan00000/article/details/7194702

智能推荐

有了市场,自研操作系统才会被真正的用起来_系统真正用起来-程序员宅基地

文章浏览阅读964次。10月23-25日,“长沙 · 中国 1024 程序员节”盛大举行,以开源为主议题,聚焦开源技术及生态建设、操作系统及硬件创新、开源社区及商业化发展等多个重要话题。大会吸引到上千名开发者现场参加,500万+程序员线上线下关注互动。齐聚岳麓,共话开源未来中国工程院院士倪光南,中国第一代程序员、“WPS之父”求伯君,西安邮电大学教授陈莉君,deepin创始人、统信软件总经理刘闻欢,华为openEuler负责人江大勇,阿里操作系统团队负责人马涛,SylixOS嵌入式操作系统创始人韩辉,RT-Thread创始._系统真正用起来

哲学家不会吃饭了,我们快来帮帮他们(C语言、进程通信)_哲学家进餐问题c语言实现-程序员宅基地

文章浏览阅读272次。哲学家不会吃饭了,我们快来帮帮他们皮老师课堂开课啦皮老师:同学们,今天我们来讨论讨论哲学家吃饭问题,哲学家吃法问题是由大名鼎鼎的Dijkstra提出的,大家看黑板,看看什么是哲学家吃饭问题。每个哲学家面前一碗面条子,每碗面间有一根筷子哲学家就会干两件事,吃饭、思考哲学家吃饭的时候要依次把左右两侧的筷子拿起来(不分次序)才能吃面吃完了把筷子放回去继续思考皮老师:如何才能不发生死锁呢?张三同学抢答:拿不到筷子就等着呗,等别旁边的吃完了不就拿到了么?皮老师:假如五个人都同_哲学家进餐问题c语言实现

Android Studio编译错误:Suggestion: use tools:overrideLibrary="xxx.xxx.xxx" to force usage_androidstudio suggestions-程序员宅基地

文章浏览阅读6.3k次。Suggestion: use tools:overrideLibrary="xxx.xxx.xxx" to force usage_androidstudio suggestions

警惕swizzle-程序员宅基地

文章浏览阅读69次。原文链接不知道什么时候开始,只要使用了swizzling都能被解读成是AOP开发,开发者张口嘴就是runtime,将其高高捧起,称之为黑魔法;以项目中各种method_swizzling为荣,却不知道这种做法破坏了代码的整体性,使关键逻辑支离破碎。本文基于iOS界的毒瘤一文,从另外的角度谈谈为什么我们应当警惕调用顺序性调用顺序性是链接文章讲述的的核心问题,它会破坏方法的原有执行顺序,导致意料..._python swizzle

openssl 编译-程序员宅基地

文章浏览阅读1k次,点赞40次,收藏8次。make。openssl compile

MySQL 5.7.27详细下载安装配置教程_mysql5.7下载-程序员宅基地

文章浏览阅读10w+次,点赞1.1k次,收藏3.2k次。本文详细介绍了Win 10下MySQL 5.7.27的安装及配置步骤,也列举出了一些常见的问题及解决方案_mysql5.7下载

随便推点

sparkSQL sparkSQL整合hive(spark on hive)-程序员宅基地

文章浏览阅读851次,点赞2次,收藏4次。sparkSQL整合hivesparkSQL整合hivesparkSQL整合hive步骤示例数据库保存在本地和数据库保存在HDFS应用场景sparkSQL整合hivesparkSQL整合hive,即spark on hive。本质是把hive当做数据源,使用spark作为计算引擎来处理数据。sparkSQL整合hive步骤把hive安装目录下conf文件夹里的hive-site.xml拷贝到集群每一个spark安装目录下对应的conf文件夹中目的:让spark知道存放hive表的元数据的M

爬虫 自动化工具-mongo-多线程爬虫_broeser-程序员宅基地

文章浏览阅读347次。一、selenium框架1、selenium介绍# 介绍: 1.selenium是一个web自动化测试用的框架. 程序员可以通过代码实现对浏览器的控制, 比如打开网页, 点 击网页中的元素, 实现鼠标滚动等操作. 2.它支持多款浏览器, 如谷歌浏览器, 火狐浏览器等等, 当然也支持无头浏览器. # 目的: 在爬取数据的过程中, 经常遇到动态数据加载, 一般动态数据加载有两种, 一种..._broeser

如何更改nrf51822的主服务uuid与特性的uuid不一样_nrf52840 服务 读 写uuid计数不一致-程序员宅基地

文章浏览阅读775次。最近有一个CSDN的好友给我留言,询问如何设置主服务uuid和特性uuid不一样,如下图:我以为这个问题很简单,网上应该一大堆,但是搜索一下,却发现没有这样的文章,于是,把自己的代码给分享出来,供大家学习。废话就少说,这里直接把代码复制下来。大家可以通过对比软件对比一下就行。使用的是SDK11的,串口服务ble_char,uint32_t ble_char_init(ble_char_t * p_char, const ble_char_init_t * p_char_init){ uin_nrf52840 服务 读 写uuid计数不一致

第十五届蓝桥杯嵌入式省赛真题题目和答案-程序员宅基地

文章浏览阅读242次。该题目是本人考完之后写的第十五届蓝桥杯嵌入式省赛真题题目和答案,有些答案也不完全确定,仅供参考,

子类继承父类重写父类的属性值问题_c# 子类修改父类的属性值为什么父类属性值没变-程序员宅基地

文章浏览阅读2.6k次,点赞2次,收藏8次。案例一试想一下代码的执行结果package com.syc.test;public class A { public static void main(String[] args) { FatherClass father = new FatherClass(); System.out.println(father.info); SonClass son = new ..._c# 子类修改父类的属性值为什么父类属性值没变

MAC风扇问题-程序员宅基地

文章浏览阅读142次。http://www.pc6.com/mac/113140.html转载于:https://www.cnblogs.com/yc5518/p/8276798.html_mac风扇不会自己启动

推荐文章

热门文章

相关标签