I recently needed to build an FTP server. I found it online and learned that the ftpserver of Apache is easy to use.
: Click to open the link
Apache's ftpserver only requires two files: ftpd-typical.xml and users. properties (in the Res/conf folder of the installation directory), and then use ftpd in the bin directory in Linux. sh command (ftpd for Windows. BAT), you can start the service (ftpd command needs to pass a parameter for RES/CONF/ftpd-typical.xml ).
Next, let's configure the 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"/* set the server identifier, you must */max-logins = "5"/* set the maximum number of simultaneous logins */anon-Enabled = "false"/* Set Anonymous logon to not allow */max-Anon -logins = "0"/* set the number of anonymous login users to 0 */max-login-failures = "3"/* after setting three failed login attempts, close this Link */login-failure-delay = "30000"/* sets the interval required for the next login after failed logon to prevent brute force cracking, the Unit is microseconds */> <listeners> <NiO-listener name = "default" Port = "2121"> <! -- Set the default connection port to 2121. Required: <SSL> <keystore file = "./RES/ftpserver. jks" Password = "password"/> <! -- Set the key storage path and key storage password, which must be --> </SSL> <data-connection idle-Timeout = "60"> <! -- Set the time to close an idle link in seconds --> <active local-Port = "1886"/> <! -- Set the active link configuration. The port number is "1886" --> <! -- Set the passive link configuration, set the port to "1886", and the extension address to "137.222.18.114 ", use --> <passive ports = "1886" address = "0.0.0.0" external-address = "137.222.18.114"/> </data-connection> </NiO-listener> </listeners> <! -- Set the user login information, ". /RES/CONF/users. properties is the file path, "encrypt-passwords = 'clear'" sets the password encryption method, the default is "MD5", set to "clear" indicates not encrypted, enter --> <file-user-manager file = ". /RES/CONF/users. properties "encrypt-passwords =" clear "/> </Server>
Next, we configure users. Properties
# Password is "admin"ftpserver.user.admin.userpassword=21232F297A57A5A743894A0E4A801FC3ftpserver.user.admin.homedirectory=./res/homeftpserver.user.admin.enableflag=trueftpserver.user.admin.writepermission=trueftpserver.user.admin.maxloginnumber=0ftpserver.user.admin.maxloginperip=0ftpserver.user.admin.idletime=0ftpserver.user.admin.uploadrate=0ftpserver.user.admin.downloadrate=0ftpserver.user.anonymous.userpassword=ftpserver.user.anonymous.homedirectory=./res/homeftpserver.user.anonymous.enableflag=falseftpserver.user.anonymous.writepermission=falseftpserver.user.anonymous.maxloginnumber=20ftpserver.user.anonymous.maxloginperip=2ftpserver.user.anonymous.idletime=300ftpserver.user.anonymous.uploadrate=4800ftpserver.user.anonymous.downloadrate=4800ftpserver.user.ftpuser.userpassword=123456ftpserver.user.ftpuser.homedirectory=./res/homeftpserver.user.ftpuser.enableflag=trueftpserver.user.ftpuser.writepermission=falseftpserver.user.ftpuser.maxloginnumber=20ftpserver.user.ftpuser.maxloginperip=2ftpserver.user.ftpuser.idletime=300ftpserver.user.ftpuser.uploadrate=4800ftpserver.user.ftpuser.downloadrate=4800
Anonymou is the default anonymous user in the system. Here, enableflag is set to false, indicating that the upload/download speed is disabled. uploadrate and downloadrate indicate that the upload/download speed is measured in bytes/s, "0" indicates no restriction. The password for adding a user named ftpuser is 123456.
Now, we can start ftpserver and enter "bin/ftpd in Linux. sh Res/CONF/ftpd-typical.xml ", then enter the address" ftp: // 137.222.18.114: 2121/"in the local resource manager.
For the setting of each field, the official documentation provides more detailed explanations of ftpserver configuration information. Here is also a translation document Baidu Library: ftpserver configuration detailed manual