Greetings all,
Please pardon what is surely something very simple I'm missing. I
need to spin up an ftp server solely for the purpose of a unit test,
and Apache FtpServer seems like exactly what I need. Except... I'm
having a bit of trouble with the user's permissions and home
directory.
The server starts fine, and I can log in with the user I'm creating,
but the I get a "550 no such directory" problem on login. As I said, I
know this is a complete "duh" thing, but I can't figure it out.
Here's my sample code:
FtpServerFactory factory = new FtpServerFactory();
FtpServer server = factory.createServer();
PropertiesUserManagerFactory userFactory = new
PropertiesUserManagerFactory();
File userFile = new File("bin/ftp/users.properties");
File userHome = new File("bin/ftp/tmpHome/");
userHome.mkdirs();
userFactory.setFile(userFile);
UserManager um = userFactory.createUserManager();
BaseUser user = new BaseUser();
user.setName("unittest");
user.setPassword("unittest");
user.setHomeDirectory(userHome.getAbsolutePath());//tried both
relative and full paths... no luck
um.save(user);
System.out.println(user.getHomeDirectory());
factory.setUserManager(um);
System.out.println( Arrays.toString(um.getAllUserNames()) );
server.start();
The directory exists and has some other files and directories in
there. I thought that by logging in with a client (I'm using FileZill
and FireFTP) I'd land in the home directory I specified in
baseUser.setHomeDirectory().
I've tried passing relative and full paths to setHomeDirectory, each
with the same result.
Can anyone tell me the very simple thing I'm missing? Again, this is
simply for a unit test, so I'm looking for the absolute minimum amount
of effort to get an ftp server running for a few seconds with a single
user to log in, CWD, and read some file attributes, and that's about
it.
Thanks so much!
Marc