Linux环境CENTOS下apache-ftpserver搭建配置及后台启动

长孙昀
2023-12-01

1、apache-ftpserver-1.1.0.tar.gz下载

2、指定Linux目录,例如:/usr/local/FTPServer。将压缩包解压到该目录下。

3、在FTPServer目录下创建工作目录,例如:dir

4、修改配置文件1:apache-ftpserver-1.1.0/res/conf/users.properties

ftpserver.user.admin.userpassword=admin123
ftpserver.user.admin.homedirectory=../dir
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

5、修改配置文件2:

<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="9921">
                    <ssl>
                <keystore file="./res/ftpserver.jks" password="password" />
            </ssl>
                    <data-connection idle-timeout="60">
                        <active local-port="9922" />
                        <passive ports="9922" />
                        </data-connection>
                </nio-listener>
        </listeners>
        <file-user-manager file="./res/conf/users.properties" encrypt-passwords="clear" />
</server>

6、启动方式1:

在apache-ftpserver-1.1.0目录下,输入命令:

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

此方式有局限,当命令窗口退出时,FTP服务停止。

7、启动方式2:

在apache-ftpserver-1.1.0目录下,输入命令:

nohup ./bin/ftpd.sh res/conf/ftpd-typical.xml & 
此方式为后台启动FTP服务,服务一直启动不管窗口是否退出。





 类似资料: