使用到的源码包为:stupid-ftpd-1.5beta.tar.gz
下载地址:
https://sourceforge.net/projects/stupid-ftpd/files/stupid-ftpd/V1_5beta/
1、解压源码包
tar -vxf stupid-ftpd-1.5beta.tar.gz
2、进入解压生成的stupid-ftpd目录
3、修改stupid-ftpd.conf配置文件
#serverroot=/usr/home/cinek/tmp3/aaa
serverroot=/home/ftp
#port=2121
port=21
4、make生成stupid-ftpd.Linux6脚本(不用make install)
在当前目录下执行
./stupid-ftpd.Linux6 -f stupid-ftpd.conf
可以看到如下消息
[email protected]:/home/chemi/neo/ftp/stupid-ftpd# ls
BUILD.AIX command.h ftpdconfig.c Makefile Makefile.win stupid-ftpd.h
BUILD.Linux5 command.o ftpdconfig.h Makefile.AIX README Stupid-FTPD.INI
BUILD.Linux6 COPYING ftpdconfig.o Makefile.Linux5 servercommand.c stupid-ftpd.Linux6
BUILD.SCO CREDITS ftperror.h Makefile.Linux6 servercommand.h stupid-ftpd.o
BUILD.SunOS ftpcommand.c ls.c Makefile.SCO TODO
CHANGES ftpcommand.h ls.h Makefile.Solaris stupid-ftpd.c
command.c ftpcommand.o ls.o Makefile.SunOS stupid-ftpd.conf
[email protected]:/home/ftp/stupid-ftpd# ./stupid-ftpd.Linux6 -f stupid-ftpd.conf
User anonymous registered.
Starting server ... OK
*ftpd>
此时ftp服务器就运行起来了。该系统的ip地址为“192.168.0.71”
验证
① 在另一个终端上执行:ftp 192.168.0.71
用户名输入:anonymous
密码输入: (空格)
如下所示
[email protected]:/home# ftp 192.168.0.71
Connected to 192.168.0.71.
220 Welcome to Stupid-FTPd server.
Name (192.168.0.71:root): anonymous
331 Guest login ok, send your e-mail address as password.
Password:
230 User anonymous logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful.
150 OK
drwxr-xr-x 3 anonymous ftp 4096 Nov 30 03:52 test
drwxr-xr-x 3 anonymous ftp 4096 Nov 30 06:19 stupid-ftpd
-rw-r--r-- 1 anonymous ftp 34487 Nov 29 11:47 stupid-ftpd-1.5beta.tar.gz
226 Transfer complete.
ftp>
② 在浏览器上输入:ftp://192.168.0.71/
如下图所示
③ 在计算机地址栏输入:ftp://192.168.0.71/
如下图所示
如果修改Makefile中CC=gcc 为自己的交叉编译器,即可以编译出在板子上运行的ftp服务器。
通过以上操作,可以方便在主机之间传递文件(当然,使用最多还是ssh)。
具体ftp的get文件和put文件操作,可以参考:
https://linux.cn/article-6746-1.html
参考链接:
https://blog.csdn.net/u011251940/article/details/78781952