On Thu, Nov 26, 2009 at 5:33 PM, Peter Cai <[email protected]> wrote:
> I wrote a little code like this to start an ftp server embedded in my
> application,  but 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.

You can find an example of how to create users using the API in the
ManagingUsers class. You can find it in the distributions, or here in
SVN:
http://svn.apache.org/repos/asf/mina/ftpserver/trunk/core/src/examples/java/org/apache/ftpserver/examples/ManagingUsers.java

To create an anonymous user, just name it "anonymous".

/niklas


>
>    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();
>    }
>
> --
> look to the things around you,the immediate world around you, if you are
> alive,it will mean something to you ——Paul Strand
>

Reply via email to