1.解压Apache FTPServer
将下载下来的压缩包(ftpserver-1.0.6.zip)解压到本地,其目录结构如下图:
2.修改users.properties
修改 apache-ftpserver-1.0.6
esconfusers.properties这个文件,管理FTP服务器用户
# Password is "admin"
ftpserver.user.admin.userpassword=21232F297A57A5A743894A0E4A801FC3
ftpserver.user.admin.homedirectory=./res/home
ftpserver.user.admin.enableflag=true
ftpserver.user.admin.writepermission=true
ftpserver.user.admin.maxloginnumber=0
ftpserver.user.admin.maxloginperip=0
ftpserver.user.admin.idletime=0
ftpserver.user.admin.uploadrate=0
ftpserver.user.admin.downloadrate=0
#密码
ftpserver.user.lizhiwei.userpassword=123456
#主目录
ftpserver.user.lizhiwei.homedirectory=./res/home
#当前用户可用
ftpserver.user.lizhiwei.enableflag=true
#具有上传权限
ftpserver.user.lizhiwei.writepermission=true
#最大登陆用户数为20
ftpserver.user.lizhiwei.maxloginnumber=20
#同IP登陆用户数为2
ftpserver.user.lizhiwei.maxloginperip=2
#空闲时间为300秒
ftpserver.user.lizhiwei.idletime=300
#上传速率限制为480000字节每秒
ftpserver.user.lizhiwei.uploadrate=48000000
#下载速率限制为480000字节每秒
ftpserver.user.lizhiwei.downloadrate=48000000
#匿名用户
ftpserver.user.anonymous.userpassword=
ftpserver.user.anonymous.homedirectory=./res/anonymous
ftpserver.user.anonymous.enableflag=true
ftpserver.user.anonymous.writepermission=false
ftpserver.user.anonymous.maxloginnumber=20
ftpserver.user.anonymous.maxloginperip=2
ftpserver.user.anonymous.idletime=300
ftpserver.user.anonymous.uploadrate=4800
ftpserver.user.anonymous.downloadrate=4800
3.修改ftpd-typical.xml
修改 apache-ftpserver-1.0.6
esconfftpd-typical.xml这个文件,设置服务器用户文件、端口号等信息
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd"
id="myServer">
<listeners>
<!-- 设置默认端口是2121,可以修改为自己的端口 -->
<nio-listener name="default" port="2121">
<ssl>
<keystore file="./res/ftpserver.jks" password="password" />
</ssl>
</nio-listener>
</listeners>
<!-- 设置用户配置文件以及,密码是否加密 -->
<file-user-manager file="./res/conf/users.properties" encrypt-passwords="clear"/>
</server>
4.运行FTPServer
运行命令:ftpd.bat res/conf/ftpd-typical.xml,如下图:
浏览器访问(必须删除匿名用户,暂不知原因),ftp://127.0.0.1:2121/:
FlashFXPPortable访问:
-------------------------------------------------------------------------------------------------------------------------------