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 Dustine Rene Bernasor <du...@thecyberguardian.com> on 2011/03/29 09:58:25 UTC

Question on using PropertiesUserManagerFactory

Hello,

I am trying to embed the Apache FTP server into my code. I have a 
property file containing a single user but when I try to connect, I get 
a 530 error.

Here's the content of my property file:
ftpserver.user.test.homedirectory=./test-tmp/ftproot
ftpserver.user.test.maxloginnumber=3
ftpserver.user.test.enableflag=true
ftpserver.user.test.writepermission=true
ftpserver.user.test.userpassword=password

Here's the code for the user management:
PropertiesUserManagerFactory userManagerFactory = new 
PropertiesUserManagerFactory();
userManagerFactory.setFile(new File("ftpusers.properties"));
UserManager um = userManagerFactory.createUserManager();
serverFactory.setUserManager(um);

I've tried adding this code for investigation purposes:
users = um.getAllUserNames();
System.out.println(users.length);

but 0 is printed. So it seems the user configuration from the property 
file was not loaded.

Can someone point out if I missed a particular step.

Thanks.

Dustine

RE: Question on using PropertiesUserManagerFactory

Posted by "Chen, Weilei (William)" <Wi...@windriver.com>.
Where did you put ftpusers.properties? You shouldn't use a relative path to the file in your code. Try to use the absolute path, for example:
userManagerFactory.setFile(new File("/home/ftp/conf/ftpusers.properties"));

-----Original Message-----
From: Dustine Rene Bernasor [mailto:dustine@thecyberguardian.com] 
Sent: Tuesday, March 29, 2011 3:58 PM
To: ftpserver-users@mina.apache.org
Subject: Question on using PropertiesUserManagerFactory

Hello,

I am trying to embed the Apache FTP server into my code. I have a property file containing a single user but when I try to connect, I get a 530 error.

Here's the content of my property file:
ftpserver.user.test.homedirectory=./test-tmp/ftproot
ftpserver.user.test.maxloginnumber=3
ftpserver.user.test.enableflag=true
ftpserver.user.test.writepermission=true
ftpserver.user.test.userpassword=password

Here's the code for the user management:
PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory(); userManagerFactory.setFile(new File("ftpusers.properties")); UserManager um = userManagerFactory.createUserManager();
serverFactory.setUserManager(um);

I've tried adding this code for investigation purposes:
users = um.getAllUserNames();
System.out.println(users.length);

but 0 is printed. So it seems the user configuration from the property file was not loaded.

Can someone point out if I missed a particular step.

Thanks.

Dustine