`
chenlong_1988
  • 浏览: 182888 次
  • 性别: Icon_minigender_2
社区版块
存档分类

【转】使用Apache FtpServer快速搭建ftp服务器

阅读更多

转自:http://www.jpriv.net/technology/ftp-server.html

Apache FtpServer是纯Java写的开源FTP服务器。

到我安装为止最新版本为1.0.6 Release,下载地址:http://mina.apache.org/ftpserver/downloads.html

1分钟搭建FTP服务(文档是说的是5分钟,其实1分钟就够了)

解压之后进入根目录(用<ftp server>代替),配置 res/conf/ftpd-typical.xml (这个配置文件,自己可以随意位置定义,信息任何名称,只要下启动服务时指定好就OK了)

<?xml version=”1.0″ encoding=”UTF-8″?>
<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>
<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>

要注意的是红色部分:port为服务器监听的端口、file为引用的用户文件、encrypt-passwords是密码加密方式(暂时用明文不加密,不配置该项的话默认使用MD5 32位大写加密)

修改上面引用的users.properties文件:

ftpserver.user.test.userpassword=test #用户名为test 密码也为test
ftpserver.user.test.homedirectory=d:/test #登录之后的根目录
ftpserver.user.test.enableflag=true #账号是否可用
ftpserver.user.test.writepermission=true #是否有写权限
ftpserver.user.test.maxloginnumber=0
ftpserver.user.test.maxloginperip=0

ftpserver.user.test.idletime=0
ftpserver.user.test.uploadrate=0
ftpserver.user.test.downloadrate=0

用DOS进入<ftp server>/bin中,执行

ftpd.bat ./res/conf/ftpd-typical.xml

服务启动成功,可以尝试本地访问或远程(注意服务器防火墙及可访问性问题)访问一下吧。

但是这样不是很方便,要把它做成Windows的服务自动启动就好了

在<ftp server>/bin 中有一个service.bat

用DOS进入<ftp server>/bin 中运行

service.bat install ftpd ./res/conf/ftpd-typical.xml

意义为:安装一个名为ftpd的服务来执行apache ftp server用的配置文件是<ftp server>/res/conf/ftpd-typical.xml

如果你不想用ftp服务了想删除系统服务,则运行下面的命令就好了

service.bat remove

 

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

 ./apache-ftpserver/bin 目录下新建一个批处理文件命名为例如: myftp.bat 

内容如下:ftpd.bat res/conf/ftpd-typical.xml 然后保存,重启FTP服务,然后运行myftp.bat,再登录。

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics