(转载)Windows 上搭建Apache FtpServer

时间:2022-02-05 05:09:46

标签:

第一步:下载Apache FTPServer

可以到官网下载: 目前最新版本是Apache FtpServer 1.0.6 Release,我这里下载的就是1.1版本

第二步:解压Apache FTPServer

将下载下来的压缩包解压到本地,我的是放在D盘根目录下,其目录结构如下图: 

第三步:修改配置文件 1.修改D:\apache-ftpserver-1.0.6\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 # # # # 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=21232F297A57A5A743894A0E4A801FC3 ftpserver.user.admin.homedirectory=D:/Program Files 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/home #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

#密码 配置新的用户
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

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

2.修改D:\apache-ftpserver-1.0.6\res\conf\ftpd-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/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"/> <!-- 添加encrypt-passwords="clear",将密码加密方式修改给clear 这样配置密码的时候就不用md5加密了--> </server>

第四步:启动FTPServer

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

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

注意:第二条命令的执行需要在环境变量中配置JAVA_HOME,否则会报错,自行百度。

运行结果如下图:

PS:FTPServer started 说明FTP服务已经启动成功

第五步:访问FTP