You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by "Pratapani, Durga" <du...@bankofamerica.com> on 2009/01/05 09:35:33 UTC

How to configure users when FTP server is embedded in Java program

Hi,

 

Thanks for your replies.

I am able to start the Apache FTP Server from command prompt.

 

But, I am facing issues with embedding FTP server.

 

FtpServerFactory serverFactory = new FtpServerFactory();

ListenerFactory factory = new ListenerFactory();

// set the port of the listener

factory.setPort(2221);

// replace the default listener

serverFactory.addListener("default", factory.createListener());

// start the server

FtpServer server = serverFactory.createServer(); 

server.start();

 

I have placed the above code sinppet in my Java program.

When I tried to login using anonymous , I am not able to do so.

 

Apparently , how do I configure users when I embed the FTP Server in a
Java program.

 

Thanks & Regards,

Durga Prasad

 



The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you received this email in error, please contact the sender immediately by reply e-mail and destroy all copies of the original message. This email is not intended as an offer or solicitation for the purchase or sale of any financial instruments.

Re: How to configure users when FTP server is embedded in Java program

Posted by Niklas Gustavsson <ni...@protocol7.com>.
Hi

Maybe this tutorial will help you, it sets up a PropertiesUserManager
as described by David in his reply.

/niklas

On Mon, Jan 5, 2009 at 9:35 AM, Pratapani, Durga
<du...@bankofamerica.com> wrote:
> Hi,
>
>
>
> Thanks for your replies.
>
> I am able to start the Apache FTP Server from command prompt.
>
>
>
> But, I am facing issues with embedding FTP server.
>
>
>
> FtpServerFactory serverFactory = new FtpServerFactory();
>
> ListenerFactory factory = new ListenerFactory();
>
> // set the port of the listener
>
> factory.setPort(2221);
>
> // replace the default listener
>
> serverFactory.addListener("default", factory.createListener());
>
> // start the server
>
> FtpServer server = serverFactory.createServer();
>
> server.start();
>
>
>
> I have placed the above code sinppet in my Java program.
>
> When I tried to login using anonymous , I am not able to do so.
>
>
>
> Apparently , how do I configure users when I embed the FTP Server in a
> Java program.
>
>
>
> Thanks & Regards,
>
> Durga Prasad
>
>
>
>
>
> The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you received this email in error, please contact the sender immediately by reply e-mail and destroy all copies of the original message. This email is not intended as an offer or solicitation for the purchase or sale of any financial instruments.
>

Re: How to configure users when FTP server is embedded in Java program

Posted by David Latorre <dv...@gmail.com>.
This really depends on your needs :

 - If you want to store your users in a Database you have
DbUserManager:
http://mina.apache.org/ftpserver/database-user-manager.html
  <http://mina.apache.org/ftpserver/database-user-manager.html>

In order to create a DbUserManager programmatically, you call
DbUserManagerFactory.createUserManager() after filling all the neccessary
properties ( the ones explained in the link  above).

 - If you'd rather have them stored in a properties file, you user
PropertiesUserManager. To create  a Properties-based User Manager, you call
PropertiesUserManagerFactory.createUserManager() after setting  the
properties file that will be used (with setFile() or setUrl() ) and when
necessary the passwordEncryptor.

In this page a PropertiesUserManager and a user are created  from code:
http://mina.apache.org/ftpserver/managing-users.html


The format for a sample properties file is:

ftpserver.user.testuser1.homedirectory=./test-tmp/ftproot
ftpserver.user.testuser1.maxloginnumber=3
ftpserver.user.testuser1.writepermission=true
ftpserver.user.testuser1.userpassword=password

ftpserver.user.admin.userpassword=admin
ftpserver.user.admin.homedirectory=./test-tmp/ftproot
ftpserver.user.admin.maxloginperip=0
ftpserver.user.admin.idletime=0
ftpserver.user.admin.enableflag=true
ftpserver.user.admin.writepermission=true
ftpserver.user.admin.maxloginnumber=0
ftpserver.user.admin.uploadrate=0
ftpserver.user.admin.downloadrate=0


2009/1/5 Pratapani, Durga <du...@bankofamerica.com>

> Hi,
>
>
>
> Thanks for your replies.
>
> I am able to start the Apache FTP Server from command prompt.
>
>
>
> But, I am facing issues with embedding FTP server.
>
>
>
> FtpServerFactory serverFactory = new FtpServerFactory();
>
> ListenerFactory factory = new ListenerFactory();
>
> // set the port of the listener
>
> factory.setPort(2221);
>
> // replace the default listener
>
> serverFactory.addListener("default", factory.createListener());
>
> // start the server
>
> FtpServer server = serverFactory.createServer();
>
> server.start();
>
>
>
> I have placed the above code sinppet in my Java program.
>
> When I tried to login using anonymous , I am not able to do so.
>
>
>
> Apparently , how do I configure users when I embed the FTP Server in a
> Java program.
>
>
>
> Thanks & Regards,
>
> Durga Prasad
>
>
>
>
>
> The information contained in this transmission may contain privileged and
> confidential information and is intended only for the use of the person(s)
> named above. If you are not the intended recipient, any review,
> dissemination, distribution or duplication of this communication is strictly
> prohibited. If you received this email in error, please contact the sender
> immediately by reply e-mail and destroy all copies of the original message.
> This email is not intended as an offer or solicitation for the purchase or
> sale of any financial instruments.
>