tags:

views:

105

answers:

1

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();
}
A: 

Try setting anon-enabled="true" in your server configuration.

The MYYN
That means I have to add a configuration file which I don't think is a good idea.
ablmf
@The @abl so your asking how do you do this programmatically without having a config file?
Earlz