英文网站营销,制作网站的步骤有哪些,企业建站新闻内容,wordpress首页不显示图片很多厂家提供的sdk#xff0c;一般都不自带ftp服务器功能#xff0c;
需要要发人员自己移植ftp服务器程序。
本文手把手教大家如何移植ftp server到arm板子。
环境
sdk#xff1a;复旦微
Buildroot 2018.02.31. 解压
$ mkdir ~/vsftpd
$ cp vsftpd-3.0.2.tar.gz ~/vs…很多厂家提供的sdk一般都不自带ftp服务器功能
需要要发人员自己移植ftp服务器程序。
本文手把手教大家如何移植ftp server到arm板子。
环境
sdk复旦微
Buildroot 2018.02.31. 解压
$ 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/软件包获取方法件文末。
2. 配置工具链
修改Makefile文件
CC arm-linux-gnueabihf-gcc根据自己的平台的工具链 3. 设置交叉编译环境编译
pengubuntu:~/vsftpd/vsftpd-3.0.2$ make
arm-linux-gnueabihf-gcc -c main.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c utility.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c prelogin.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c ftpcmdio.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c postlogin.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c privsock.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c tunables.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c ftpdataio.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c secbuf.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c ls.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c postprivparent.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c logging.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c str.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c netstr.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c sysstr.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c strlist.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c banner.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c filestr.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c parseconf.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c secutil.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c ascii.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c oneprocess.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c twoprocess.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c privops.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c standalone.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c hash.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c tcpwrap.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c ipaddrparse.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c access.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c features.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c readwrite.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c opts.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c ssl.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c sslslave.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c ptracesandbox.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c ftppolicy.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c sysutil.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c sysdeputil.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -c seccompsandbox.c -O2 -fPIE -fstack-protector --paramssp-buffer-size4 -Wall -W -Wshadow -Werror -Wformat-security -D_FORTIFY_SOURCE2 -idirafter dummyinc
arm-linux-gnueabihf-gcc -o vsftpd main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o tunables.o ftpdataio.o secbuf.o ls.o postprivparent.o logging.o str.o netstr.o sysstr.o strlist.o banner.o filestr.o parseconf.o secutil.o ascii.o oneprocess.o twoprocess.o privops.o standalone.o hash.o tcpwrap.o ipaddrparse.o access.o features.o readwrite.o opts.o ssl.o sslslave.o ptracesandbox.o ftppolicy.o sysutil.o sysdeputil.o seccompsandbox.o -Wl,-s -fPIE -pie -Wl,-z,relro -Wl,-z,now ./vsf_findlibs.shmake 后当前目录下会生成两个文件vsftpd 和 vsftpd.conf这两个文件是我们要用的。
4. 复制文件
将生成的 vsftpd 复制到目标板 /usr/sbin 目录vsftpd.conf 复制到目标板 /etc 目录并添加 vsftpd 为可执行
复制执行文件到目标板
vsftpd拷贝到板子usr/sbin添加可执行权限
chmod x /usr/sbin/vsftpd 复制配置文件到目标板 vsftpd.conf 拷贝到板子/etc/ 5. 配置
在目标板上创建一个本地用户ftp并设置密码123456
$ adduser ftp
Changing password for root
New password:
Retype password:
Password for ftpadmin changed by root使用 vi 打开 vsftpd.conf 文件并进行配置如下配置可实现正常上传下载功能,这段可以随便改)
用户ftp
# 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 vsftpds
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enableYES
#
# Uncomment this to allow local users to log in.
local_enableYES
#
# Uncomment this to enable any form of FTP write command.
write_enableYES
#
# 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 ftpds)
local_umask022
file_open_mode0777
#
# 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_enableYES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enableYES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enableYES
#
# Activate logging of uploads/downloads.
xferlog_enableYES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20YES
#
# 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_uploadsYES
#chown_usernamewhoever
#
# 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_formatYES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout120
#
# 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_userftpsecure
#
# 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_enableYES
#
# 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_enableYES
#ascii_download_enableYES
#
# You may fully customise the login banner string:
ftpd_bannerWelcome to 6902 FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enableYES
# (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().
# (Warning! chrooting can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_userYES
#chroot_list_enableYES
# (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_enableYES
#
# 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.
listenYES
#
# 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_ipv6YESftp_usernameftp #登录用户
secure_chroot_dir/mnt/ #6. 打开vsftp
配置完之后在目标板上打开vsftp命令
# /usr/sbin/vsftpd 注意后面还有一个 表示该服务放到后台运行。
7. 设置开机自启动
如果要让 vsftpd 开机启动可以创建下面文件S70vsftpd
然后将该文件添加到/etc/init.d/目录下。
#! /bin/shset -eDESCvsftpd
NAMEvsftpd
DAEMON/usr/sbin/$NAMEcase $1 instart)printf Starting $DESC: start-stop-daemon -S -b -x $NAMEecho OK;;stop)printf Stopping $DESC: start-stop-daemon -K -x $NAMEecho OK;;restart|force-reload)echo Restarting $DESC: $0 stopsleep 1$0 startecho ;;*)echo Usage: $0 {start|stop|restart|force-reload} 2exit 1;;
esacexit 0开启vsftpd /etc/init.d/S70vsftpd restart重启vsftpd: /etc/init.d/S70vsftpd restart8. 客户端测试
下面以pc为例
C:\Users\ricksftp
ftp open 192.168.31.45
连接到 192.168.31.45。
220 Welcome to EC20 FTP service.
200 Always in UTF8 mode.
用户(192.168.31.45:(none)): root
331 Please specify the password.
密码:
230 Login successful.显示文件列表
ftp ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
123
226 Directory send OK.
ftp: 收到 5 字节用时 0.00秒 1.25千字节/秒。下载文件
ftp get 123
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for 123 (8 bytes).
226 Transfer complete.
ftp: 收到 8 字节用时 0.00秒 8.00千字节/秒。退出
ftp quit
221 Goodbye.后台回复tools 文章转载自: http://www.morning.c7497.cn.gov.cn.c7497.cn http://www.morning.mrgby.cn.gov.cn.mrgby.cn http://www.morning.mftdq.cn.gov.cn.mftdq.cn http://www.morning.bkqw.cn.gov.cn.bkqw.cn http://www.morning.wttzp.cn.gov.cn.wttzp.cn http://www.morning.qbrdg.cn.gov.cn.qbrdg.cn http://www.morning.rnxw.cn.gov.cn.rnxw.cn http://www.morning.tzcr.cn.gov.cn.tzcr.cn http://www.morning.bbtn.cn.gov.cn.bbtn.cn http://www.morning.nypgb.cn.gov.cn.nypgb.cn http://www.morning.kscwt.cn.gov.cn.kscwt.cn http://www.morning.zwmjq.cn.gov.cn.zwmjq.cn http://www.morning.dxsyp.cn.gov.cn.dxsyp.cn http://www.morning.lqgtx.cn.gov.cn.lqgtx.cn http://www.morning.mggwr.cn.gov.cn.mggwr.cn http://www.morning.piekr.com.gov.cn.piekr.com http://www.morning.pqqxc.cn.gov.cn.pqqxc.cn http://www.morning.jbshh.cn.gov.cn.jbshh.cn http://www.morning.trpq.cn.gov.cn.trpq.cn http://www.morning.xpzkr.cn.gov.cn.xpzkr.cn http://www.morning.nbpqx.cn.gov.cn.nbpqx.cn http://www.morning.qrqdr.cn.gov.cn.qrqdr.cn http://www.morning.lwgsk.cn.gov.cn.lwgsk.cn http://www.morning.rjnm.cn.gov.cn.rjnm.cn http://www.morning.jhqcr.cn.gov.cn.jhqcr.cn http://www.morning.fpyll.cn.gov.cn.fpyll.cn http://www.morning.zwppm.cn.gov.cn.zwppm.cn http://www.morning.ndlww.cn.gov.cn.ndlww.cn http://www.morning.fkrzx.cn.gov.cn.fkrzx.cn http://www.morning.plwfx.cn.gov.cn.plwfx.cn http://www.morning.bpmnc.cn.gov.cn.bpmnc.cn http://www.morning.rljr.cn.gov.cn.rljr.cn http://www.morning.djmdk.cn.gov.cn.djmdk.cn http://www.morning.hxgly.cn.gov.cn.hxgly.cn http://www.morning.rbktw.cn.gov.cn.rbktw.cn http://www.morning.kqpq.cn.gov.cn.kqpq.cn http://www.morning.gfnsh.cn.gov.cn.gfnsh.cn http://www.morning.kszkm.cn.gov.cn.kszkm.cn http://www.morning.rzcmn.cn.gov.cn.rzcmn.cn http://www.morning.bloao.com.gov.cn.bloao.com http://www.morning.ctwwq.cn.gov.cn.ctwwq.cn http://www.morning.fjptn.cn.gov.cn.fjptn.cn http://www.morning.xbmwm.cn.gov.cn.xbmwm.cn http://www.morning.lpzyq.cn.gov.cn.lpzyq.cn http://www.morning.jyfrz.cn.gov.cn.jyfrz.cn http://www.morning.skrww.cn.gov.cn.skrww.cn http://www.morning.tgmfg.cn.gov.cn.tgmfg.cn http://www.morning.nfdty.cn.gov.cn.nfdty.cn http://www.morning.fhkr.cn.gov.cn.fhkr.cn http://www.morning.mygbt.cn.gov.cn.mygbt.cn http://www.morning.cpfbg.cn.gov.cn.cpfbg.cn http://www.morning.tbkqs.cn.gov.cn.tbkqs.cn http://www.morning.hjsrl.cn.gov.cn.hjsrl.cn http://www.morning.gmmyn.cn.gov.cn.gmmyn.cn http://www.morning.nnpfz.cn.gov.cn.nnpfz.cn http://www.morning.gbfzy.cn.gov.cn.gbfzy.cn http://www.morning.cmhkt.cn.gov.cn.cmhkt.cn http://www.morning.snrbl.cn.gov.cn.snrbl.cn http://www.morning.spxsm.cn.gov.cn.spxsm.cn http://www.morning.qyjqj.cn.gov.cn.qyjqj.cn http://www.morning.ryxyz.cn.gov.cn.ryxyz.cn http://www.morning.lbhck.cn.gov.cn.lbhck.cn http://www.morning.fstdf.cn.gov.cn.fstdf.cn http://www.morning.ssqwr.cn.gov.cn.ssqwr.cn http://www.morning.glxdk.cn.gov.cn.glxdk.cn http://www.morning.qrpx.cn.gov.cn.qrpx.cn http://www.morning.pclgj.cn.gov.cn.pclgj.cn http://www.morning.pjwrl.cn.gov.cn.pjwrl.cn http://www.morning.wbhzr.cn.gov.cn.wbhzr.cn http://www.morning.uytae.cn.gov.cn.uytae.cn http://www.morning.lizpw.com.gov.cn.lizpw.com http://www.morning.yzdth.cn.gov.cn.yzdth.cn http://www.morning.bwdnx.cn.gov.cn.bwdnx.cn http://www.morning.rfpb.cn.gov.cn.rfpb.cn http://www.morning.zbnkt.cn.gov.cn.zbnkt.cn http://www.morning.smj78.cn.gov.cn.smj78.cn http://www.morning.ltqtp.cn.gov.cn.ltqtp.cn http://www.morning.fhtmp.cn.gov.cn.fhtmp.cn http://www.morning.hwbmn.cn.gov.cn.hwbmn.cn http://www.morning.plqqn.cn.gov.cn.plqqn.cn