Title: How to configure Apache FtpServer?
Tags: spring;ftp
Question: I found this very simple description on Apache FtpServer's document:
Integration with Spring Framework
Apache FtpServer uses Spring Framework to implement the configuration. That also means that we get the added benefit of full integration with regular Spring XML configuration. For example, you can embed the &quot;server&quot; element where ever you like within you Spring configuration, and with FtpServer on the classpath, Spring will wire up the server for you.
Nothing else about:
Where should I put this configure file?
What should the file name be?
How could the application find that file?
Do I have study Spring's Configure Framework to know all about it?
Comment: The snippet in question seems to be from here http://mina.apache.org/ftpserver/configuration.html

Here is the accepted answer: There is documentation about that, and it wasn't too hard to find. It's on this page:
http://mina.apache.org/ftpserver-project/running_ftpserver_standalone.html
Turns out that you specify the XML configuration file simply on the command line when starting the server:
bin/ftpd.sh res/conf/ftpd-typical.xml
For Windows:
bin/ftpd.bat res/conf/ftpd-typical.xml
I just tried this for myself: I downloaded the server, fired off the command, and... it started serving.
Comment for this answer: I've found that also, it seems that I have read source code ftpd to see how it use the configuration file.
Comment for this answer: I finally found that : 1. to embed an FtpServer, configure file is not needed.  2. BUT you have to give a user.properties file otherwise anonymous user would not be able to login.
Comment for this answer: After configuration how do you connect to the server? I am trying to connect it from the same host. `ftp localhost` and `ftp 151.154.11.224` are not working.

Here is another answer: You were asking about embedded FTP server in another question. There are instructions for embedded usage. When embedding, you do not need any configuration files, you can use API to give server all the required information.
You do not need to know Spring configuration (unless you use Spring framework elsewhere in your project). The ftp library should take care of configuration automatically.
Comment for this answer: I also expected that would work without any configure file, until I found that no client could login but keeps getting 530 authentication fail.  Here is my code : http://pastebin.com/d49bc7e7e
Comment for this answer: I know that FtpServer does not "require" XML files for configuration when using embedded, and their examples for programmatic configuration of embedded is straight forward.  However, there is no reason at all why I should not be able to embed FtpServer into my Java app and still configure it by XML file, and that use case isn't griffithjames@example.org.  Guess I have to reverse engineer from the Bourne scripts forward.
Comment for this answer: Your code explicitly creates a PropertiesUserManagerFactory object that reads values from a file. Instead, create an UserManager instance that accepts requests from every user.
Comment for this answer: @ablmf, your link is broken

Here is another answer: Spring's config mechanism is surprisingly simple yet flexible - essentially just an XML file defining a bunch of objects and their relationships (by specifying constructor parameters, invoking setters and so on - just like you would do from code).
One key point is that it wires together objects that are otherwise perfectly normal (no "Spring magic"). So you can take Spring components and use them independently of the config mechanism - handy for testing and re-use in other frameworks, or take external components and use them in a Spring project with no changes.

Here is another answer: Using Embedding FtpServer in 5 minutes as example you can wire spring beans like this:
<bean id="ftpServer" factory-bean="ftpServerFactory" factory-method="createServer" init-method="start" /&gt;
<bean id="ftpServerFactory" class="org.apache.ftpserver.FtpServerFactory"&gt;
<property name="userManager"&gt;
<bean id="ftpUsers" factory-bean="ftpUsersFactory" factory-method="createUserManager" /&gt;
</property&gt;
</bean&gt;
<bean id="ftpUsersFactory" class="org.apache.ftpserver.usermanager.PropertiesUserManagerFactory"&gt;
<property name="file" value="users.properties" /&gt;
</bean&gt;
It will start a FTP server on port 21 using user configuration from the properties file (I used the one provided in the release)

Here is another answer: Can't tell if the original questioner wanted to configure FtpServer via XML, or whether he/she doesn't know if that is a requirement of embedding.
As clearly shown in the product documentation, and as pointed out by other answers here, it's straight forward to configure FtpServer entirely programmatically.
But I figure that if the original questioner did want to do it, surely lots of people will recognize the administrative benefits to configuring FtpServer declaratively with XML in an embedded application.  Here's how to do it:
Yes, you do need to use Spring to use XML configs for FtpServer, but you don't need to learn anything about Spring.
Just code this single statement to instantiate your FTP server, configured with the specified XML file:
FtpServer server = new FileSystemXmlApplicationContext("config/ftpd.xml").getBean("fServer", FtpServer.class);
(And you will obviously need to .start() it afterwards... that's it).
There are other ways to load the bean from the bean file, but this is simple and serviceable and it's easy enough for you to change your element's ID to match the specified bean name ("fServer" in the line above).
The XML file path is relative to where the JVM ("java") is invoked from, but you can use an absolute path instead.
You could also load the XML file as a CLASSPATH resource instead of from the filesystem.  That has advantages and disadvantages and I won't take time here to discuss them, nor how to do that.
The only other thing to know is, you will require a couple Spring jar files in your compilation CLASSPATH, and many Spring jar files in your runtime CLASSPATH.  ALl of these jars are readily available in the Maven central repository, and all together they come in at under 3 MB.  Here are the jar dependencies in Ivy format:
<dependency name="mina-core" org="org.apache.mina" rev="2.0.4" conf="runtime"/&gt;
<dependency name="slf4j-api" org="org.slf4j" rev="1.6.3" conf="runtime"/&gt;
<dependency name="jcl-over-slf4j" org="org.slf4j" rev="1.6.3" conf="runtime"/&gt;
<dependency name="slf4j-jdk14" org="org.slf4j" rev="1.6.3" conf="runtime"/&gt;
<dependency name="ftplet-api" org="org.apache.ftpserver" rev="1.0.6" conf="runtime"/&gt;
<dependency name="ftpserver-core" org="org.apache.ftpserver" rev="1.0.6"/&gt;
<dependency name="spring-context" org="org.springframework"
rev="3.0.6.RELEASE"/&gt;
<dependency name="spring-core" org="org.springframework"
rev="3.0.6.RELEASE"/&gt;
<dependency name="spring-beans" org="org.springframework"
rev="3.0.6.RELEASE"/&gt;
<dependency name="spring-asm" org="org.springframework" conf="runtime"
rev="3.0.6.RELEASE"/&gt;
<dependency name="spring-expression" org="org.springframework" conf="runtime"
rev="3.0.6.RELEASE"/&gt;

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 5, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 2.5', 'CreationDate': '2009:00:11/28/09', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<spring><ftp>', 'Title': 'How to configure Apache FtpServer?', 'ViewCount': 24621, 'id': 1812373, 'user_AboutMe': None, 'user_AccountId': 45709.0, 'user_DisplayName': 'faceclean', 'user_Reputation': 3721.0, 'user_Views': 430.0, 'user_id': 134852.0}}