使用Apache FtpServer搭建FTP服务器

Apache FtpServer是纯Java写的(基于mina-http://mina.apache.org/)开源FTP服务器。 http://mina.apache.org/ftpserver/

一. 安装

 

1. 从 http://mina.apache.org/ftpserver/ 下载

  http://mina.apache.org/ftpserver/downloads.html

2. 解压缩到本地

 


二. 启动ftpserver

进入 %FtpServer_Home%/bin下 新建bun.bat,内容如下

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

保存run.bat,然后双击运行

访问 yourip:2121

注:直接运行 ftpd.bat启动起来的ftpserver没有任何用户信息,所以是没有意义的.apache ftpserver为我们提供了两个现有的服务配置

使用Apache FtpServer搭建FTP服务器_第1张图片

以上我们是用它提供的一个典型的配置信息ftpd-typical.xml(在运行ftpd.bat时将res/conf/ftpd-typical.xml作为参数传入),而用户信息位于users.properties中



三. 配置用户信息

res\conf\users.properties:

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.


# Password is "admin"
#格式 ftpserver.user.用户名.属性


#密码
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.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




你可能感兴趣的:(java,apache,FTP服务器,File,express,permissions)