User Tools

Site Tools


mina_ftp

Mina FTP

Standalone FTP server written is JAVA.
which use MINA Framework, could be use to deploy service in min.

Source : Mina FTP

Copy following files

tar -xvf springsource-tool-suite-2.6.0.RELEASE-e3.6.2-linux-gtk-x86_64.tar.gz
cp tc-server-developer-2.1.1.RELEASE/lib/com.springsource.org.apache.commons.cli-1.2.0.jar /opt/ftpd/common/lib/
cd /opt/ftpd/cd /usr/local/src/
wget http://s3.amazonaws.com/dist.springframework.org/milestone/SPR/spring-framework-3.1.0.M1.zip
unzip spring-framework-3.1.0.M1.zip 
cd spring-framework-3.1.0.M1/dist
cp org.springframework.jdbc-3.1.0.M1.jar /opt/ftpd/common/lib/
wget http://apache.mirrors.tds.net//commons/pool/binaries/commons-pool-1.5.5-bin.tar.gz
tar -xvf commons-pool-1.5.5-bin.tar.gz 
cp commons-pool-1.5.5.jar /opt/ftpd/common/lib/
cd /opt/ftpd
keytool -genkey -alias ftp.k2patel.com -keyalg RSA o- keystore k2patel.jks -keysize 2048
keytool -genkey -alias ftp.k2patel.com -keyalg RSA -keystore k2patel.jks -keysize 2048
keytool -genkey -keyalg RSA -alias selfSigned -keystore k2patel.jks -storepass test123 -validity 3650 -keysize 2048

Now use following service config.

| typical.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://mina.apache.org/ftpserver/spring/v1"
             xmlns:beans="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:tx="http://www.springframework.org/schema/tx"
             xmlns:aop="http://www.springframework.org/schema/aop"
             xsi:schemaLocation=" http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
             http://www.springframework.org/schema/tx
             http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
             http://www.springframework.org/schema/aop
             http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
             http://www.springframework.org/schema/lang
             http://www.springframework.org/schema/lang/spring-lang-2.0.xsd
             http://mina.apache.org/ftpserver/spring/v1
             http://mina.apache.org/ftpserver/ftpserver-1.0.xsd ">
    <beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <beans:property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <beans:property name="url" value="jdbc:mysql://localhost/ftpuser"/>
        <beans:property name="username" value="ftpuser"/>
        <beans:property name="password" value="servent"/>
    </beans:bean>
    <server id="server">
        <listeners>
            <nio-listener name="default" port="21"></nio-listener>
        </listeners>
        <db-user-manager encrypt-passwords="md5">
            <data-source>                <beans:ref bean="dataSource"/>
            </data-source>
 
	<insert-user>INSERT INTO FTP_USER (userid, userpassword, homedirectory, enableflag, writepermission, idletime, uploadrate, downloadrate) VALUES ('{userid}', '{userpassword}', '{homedirectory}', {enableflag}, {writepermission}, {idletime}, {uploadrate}, {downloadrate})
	</insert-user>
	<update-user>UPDATE FTP_USER SET userpassword='{userpassword}',homedirectory='{homedirectory}',enableflag={enableflag},writepermission={writepermission},idletime={idletime},uploadrate={uploadrate},downloadrate={downloadrate} WHERE userid='{userid}'
	</update-user>
	<delete-user>DELETE FROM FTP_USER WHERE userid = '{userid}'
	</delete-user>
	<select-user>SELECT userid, userpassword, homedirectory, enableflag, writepermission, idletime, uploadrate, downloadrate, maxloginnumber, maxloginperip FROM FTP_USER WHERE userid = '{userid}'
	</select-user>
	<select-all-users>SELECT userid FROM FTP_USER ORDER BY userid
	</select-all-users>
	<is-admin>SELECT userid FROM FTP_USER WHERE userid='{userid}' AND userid='admin'
	</is-admin>
	<authenticate>SELECT userpassword from FTP_USER WHERE userid='{userid}'
	</authenticate>
 
        </db-user-manager>
        <native-filesystem case-insensitive="false" create-home="true"/>
    </server>
</beans:beans>
| User Table Structure
FTP_USER Table Structure
Column 	Type 	Default value
userid 	VARCHAR(64), Primary key 	 
userpassword 	VARCHAR(64) 	 
homedirectory 	VARCHAR(128) 	 
enableflag 	BOOLEAN 	TRUE
writepermission 	BOOLEAN 	FALSE
idletime 	INT 	0
uploadrate 	INT 	0
downloadrate 	INT 	0
maxloginnumber 	INT 	0
maxloginperip 	INT 	0 

Start server you are good to go

mina_ftp.txt · Last modified: 2020/08/10 02:35 (external edit)