Windows 上搭建Apache FtpServer

–>

第一步:下载Apache FTPServer

可以到官网下载:http://mina.apache.org/ftpserver-project/downloads.html

第二步:解压Apache FTPServer

将下载下来的压缩包解压到本地

第三步:修改配置文件

1.修改apache-ftpserver-1.1.1\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.admin.userpassword=123456
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.lxw.userpassword=123456
#主目录
ftpserver.user.lxw.homedirectory=./res/home
#当前用户可用
ftpserver.user.lxw.enableflag=true
#具有上传权限
ftpserver.user.lxw.writepermission=true
#最大登陆用户数为20
ftpserver.user.lxw.maxloginnumber=20
#同IP登陆用户数为2
ftpserver.user.lxw.maxloginperip=2
#空闲时间为300秒
ftpserver.user.lxw.idletime=300
#上传速率限制为480000字节每秒
ftpserver.user.lxw.uploadrate=48000000
#下载速率限制为480000字节每秒
ftpserver.user.lxw.downloadrate=48000000

如果不希望匿名登录的话,可以将匿名用户这个配置注释掉

2.修改apache-ftpserver-1.1.1\res\conf\ftpd-typical.xml这个文件

<?xml version="1.0" encoding="UTF-8"?>
	<!--
		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.
	-->
<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"/>
    <!-- 添加encrypt-passwords="clear",将密码加密方式修改给clear -->
</server>

第四步:启动FTPServer

打开CMD命令窗口,切换到apache-ftpserver-1.1.1\bin这个目录下 输入以下命令:

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

第五步:访问FTP

在游览器中,输入ftp://ip:2121进行访问,如果端口修改了,要换成对应的端口,ip就是FTP所在的服务器的ip,访问如下图所示:

第六步:FTPServer的启动与关闭

果将这个dos命令行关掉,则ftp服务停止。因此需要把第四步的启动制作成bat文件,内容为:

F:
cd F:\ftp文件服务器\apache-ftpserver-1.1.1\apache-ftpserver-1.1.1\bin
ftpd.bat res/conf/ftpd-typical.xml

点击即可启动ftp服务器。

本文来源 互联网收集,文章内容系作者个人观点,不代表 本站 对观点赞同或支持。如需转载,请注明文章来源,如您发现有涉嫌抄袭侵权的内容,请联系本站核实处理。

© 版权声明

相关文章