How to allow anonymous login in org.apache.ftpserver?

Posted by ablmf on Stack Overflow See other posts from Stack Overflow or by ablmf
Published on 2009-11-27T13:21:35Z Indexed on 2010/04/11 7:03 UTC
Read the original article Hit count: 360

Filed under:
|

I wrote a little code like this to start an ftp server embedded in my application. It's based on apache ftpserver

I found that anonymous user could not login. Client keeps get 530.

Do I have add a configure file for ftp? I can not find any API to create a User to add to UserManger.

private void start_ftp() throws FtpException {
    FtpServerFactory serverFactory = new FtpServerFactory();

    ListenerFactory factory = new ListenerFactory();

    // set the port of the listener
    factory.setPort(DEF_FTP_PORT);

    // replace the default listener
    serverFactory.addListener("default", factory.createListener());

    Ftplet fl = new MyFtplet();

    Map<String, Ftplet> map_ftplest = new LinkedHashMap<String, Ftplet>();
    map_ftplest.put("default", fl);

    serverFactory.setFtplets(map_ftplest);

    UserManagerFactory u_factory = new PropertiesUserManagerFactory();
    UserManager u_manager = u_factory.createUserManager();
    //u_manager.
    Boolean b = u_manager.doesExist("anonymous");

    serverFactory.setUserManager(u_manager);

    // start the server
    server = serverFactory.createServer();

    server.start();
}

© Stack Overflow or respective owner

Related posts about java

Related posts about ftp