Apache ftpserver简单部署使用

下载连接

1.1.4(8 9使用) 1.1.0(6使用)


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=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
ftpserver.user.anonymous.enableflag=false
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.tms.userpassword=tms
ftpserver.user.tms.homedirectory=/media/cinema
ftpserver.user.tms.enableflag=true
ftpserver.user.tms.writepermission=true
ftpserver.user.tms.maxloginnumber=999
ftpserver.user.tms.maxloginperip=999
ftpserver.user.tms.idletime=300
ftpserver.user.tms.uploadrate=9999999999999999999999999999999
ftpserver.user.tms.downloadrate=9999999999999999999999999999999

ftpserver.user.kdm.userpassword=kdm
ftpserver.user.kdm.homedirectory=/media/kdm
ftpserver.user.kdm.enableflag=true
ftpserver.user.kdm.writepermission=true
ftpserver.user.kdm.maxloginnumber=999
ftpserver.user.kdm.maxloginperip=999
ftpserver.user.kdm.idletime=300
ftpserver.user.kdm.uploadrate=9999999999999999999999999999999
ftpserver.user.kdm.downloadrate=9999999999999999999999999999999

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/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd" id="myServer">
		<listeners>
			<nio-listener name="default" port="21">
			    <ssl>
	                <keystore file="./res/ftpserver.jks" password="password" />
	            </ssl>
				<!--注意:如果要支持外网连接,需要使用被动模式passive,默认开启主动模式-->
				<data-connection idle-timeout="60">
					<active enabled="true" ip-check="true" />
					<!-- <passive ports="2000-2222" address="0.0.0.0" external-address="xxx.xxx.xxx.xxx" /> -->
				</data-connection>
				<!--添加ip黑名单-->
				<blacklist>127.0.0.1</blacklist>
			</nio-listener>
		</listeners>
		
		<!--这里添加encrypt-passwords="clear",去掉密码加密-->
		<file-user-manager file="./res/conf/users.properties" encrypt-passwords="clear" />
	</server>


启动

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

服务器脚本

[Unit]
Description=FTP Server
After=network.target

[Service]
ExecStart=/home/smart/.tms3/apache-ftpserver-1.1.4/bin/ftpd.sh res/conf/ftpd-typical.xml
WorkingDirectory=/home/smart/.tms3/apache-ftpserver-1.1.4
Restart=always
User=root

[Install]
WantedBy=multi-user.target

注意!!

6.10需要使用1.1.0版本