Hi all, Sorry for the message size. Last mail went to the spam .. Probally beacause I posted some code and log ... I dont know if you allow posting code here ... If dont, please let me know. In order to provide you more information, I tried snipt.org (a website for sharing code snippets).
After many tests, I could reach the following code that I think it could show you what is going on: http://snipt.org/kpomo/ When the server starts, I do the following commands: > ftp> open localhost Connected to danilo-pc. 220 Service ready for new user. User (danilo-pc:(none)): danilo 331 User name okay, need password for danilo. Password: 550 Requested action not taken. Login fail. Here is the log file: http://snipt.org/kpong/ Like I've comment on the code, when I test directories, first time I get ok and second time no ... This seems to occur based on authenticate method when it returns VsfInfo. Im using these libs: > commons-vfs-1.0.jar ftplet-api-1.0.5.jar ftpserver-core-1.0.5.jar mina-core-2.0.0-RC1.jar slf4j-api-1.5.2.jar slf4j-log4j12-1.5.2.jar vfsutils-ftpserver-0.1.0-SNAPSHOT.jar vfsutils-utils-0.1.0-SNAPSHOT.jar Sorry again for sending too many information. Thanks in advance, 2010/10/18 Danilo Rosetto Muñoz <[email protected]> > Hi, I have this code: > > FtpServerFactory serverFactory = new FtpServerFactory(); > >> ListenerFactory factory = new ListenerFactory(); > > factory.setPort(21); > > serverFactory.addListener("default", factory.createListener()); > > >> serverFactory.setFileSystem(new VfsFileSystemFactory()); > > >> VfsUser user = new VfsUser(); > > user.setName("danilo"); > > user.setPassword("danilo"); > > user.setHomeDirectory("ram://ftp/danilo"); > > user.setEnabled(true); > > FileSystemManager fsm = VFS.getManager(); > > FileObject root = fsm.resolveFile("ram://root"); > > FileObject rootDir = fsm.createVirtualFileSystem(root); > > rootDir.createFolder(); > > FileObject homeDir = rootDir.resolveFile("ram://root/danilo"); > > homeDir.createFolder(); > > VfsInfo vfsInfo = new VfsInfo(rootDir, homeDir, true); > > user.setVfsInfo(vfsInfo); > > List<Authority> authorities = new ArrayList<Authority>(); > > authorities.add(new WritePermission()); > > user.setAuthorities(authorities); > > VfsUserManager um = new VfsUserManager(); > > um.save(user); > > serverFactory.setUserManager(um); > > >> FtpServer server = serverFactory.createServer(); > > server.start(); > > > I'm using the following libs: > commons-vfs-1.0.jar > ftplet-api-1.0.5.jar > ftpserver-core-1.0.5.jar > mina-core-2.0.0-RC1.jar > slf4j-api-1.5.2.jar > slf4j-log4j12-1.5.2.jar > vfsutils-ftpserver-0.1.0-SNAPSHOT.jar > vfsutils-utils-0.1.0-SNAPSHOT.jar > > The code works and starts de server ok, but I have the following error > during authentication: > >> ftp> open localhost > > Conectado a danilo-pc. > > 220 Service ready for new user. > > Usuário (danilo-pc:(none)): danilo > > 331 User name okay, need password for danilo. > > Senha: > > 530 Authentication failed. > > > Do you think updating to commons-vfs-2.0-SNAPSHOT.jar may help? > > Thank you, > > On Mon, Oct 18, 2010 at 12:26 PM, Frank van der Kleij > <[email protected]>wrote: > >> >> I compiled it; you can first try with VFS 1.0 if you want, the interfaces >> didn't change that much. >> >> >> > Date: Mon, 18 Oct 2010 11:56:31 -0200 >> > Subject: Re: FtpServer - Receive files by memory >> > From: [email protected] >> > To: [email protected] >> > >> > I cant find commons-vfs-2.0-SNAPSHOT.jar ... I tried google, project >> page >> > (apache) and sourceforge ... >> > >> > I found >> http://svn.apache.org/repos/asf/commons/proper/vfs/branches/VFS-2.0/ >> > ..Should >> > I download code and compile or do you have it in some repository? >> > >> > Best regards, >> > >> > On Mon, Oct 18, 2010 at 11:29 AM, Frank van der Kleij < >> [email protected]>wrote: >> > >> > > >> > > I think you'd better use commons-vfs-2.0-SNAPSHOT.jar. You should also >> add >> > > vfsutils-ftpserver-0.1.0-SNAPSHOT.jar and >> vfsutils-utils-0.1.0-SNAPSHOT.jar. >> > > >> > > Then to use it you should use the filesystem class provided in the >> vfsutils >> > > libraries (org.vfsutils.ftpserver.filesystem.VfsFileSystemFactory) and >> > > configure it, see >> > > http://vfs-utils.sourceforge.net/ftpserver/configuration.html >> > > >> > > Frank >> > > >> > > > Date: Mon, 18 Oct 2010 09:10:08 -0200 >> > > > Subject: Re: FtpServer - Receive files by memory >> > > > From: [email protected] >> > > > To: [email protected] >> > > > >> > > > I was trying to implement use of VSF when you give me this tip. >> > > > >> > > > I check the website you provided ( >> > > > http://vfs-utils.sourceforge.net/ftpserver/index.html): >> > > > *To use this bridge you should just add the VFS libraries, the VFS >> FTP >> > > > Server library and, if needed, your custom VFS Provider and its >> > > dependencies >> > > > to the common/lib directory of your Apache FTP Server installation.* >> > > > >> > > > So, I've added the following libs to my project: >> > > > commons-vfs-1.0.jar >> > > > ftplet-api-1.0.5.jar >> > > > ftpserver-core-1.0.5.jar >> > > > mina-core-2.0.0-RC1.jar >> > > > slf4j-api-1.5.2.jar >> > > > slf4j-log4j12-1.5.2.jar >> > > > >> > > > <http://vfs-utils.sourceforge.net/ftpserver/index.html>The FTP >> server >> > > > started and works, but doesn´t with VSF. This is code I'm using: >> > > > >> > > > > FtpServerFactory serverFactory = new FtpServerFactory(); >> > > > >> > > > ListenerFactory factory = new ListenerFactory(); >> > > > >> > > > factory.setPort(21); >> > > > >> > > > serverFactory.addListener("default", factory.createListener()); >> > > > >> > > > >> > > > > PropertiesUserManagerFactory userManagerFactory = new >> > > > > PropertiesUserManagerFactory(); >> > > > >> > > > userManagerFactory.setFile(new File("etc/ftp-users.properties")); >> > > > >> > > > userManagerFactory.setPasswordEncryptor(new >> SaltedPasswordEncryptor()); >> > > > >> > > > >> > > > > BaseUser user = new BaseUser(); >> > > > >> > > > user.setName("danilo"); >> > > > >> > > > user.setPassword("mypass"); >> > > > >> > > > user.setHomeDirectory("ram://ftp/danilo"); >> > > > >> > > > user.setEnabled(true); >> > > > >> > > > List<Authority> authorities = new ArrayList<Authority>(); >> > > > >> > > > authorities.add(new WritePermission()); >> > > > >> > > > user.setAuthorities(authorities); >> > > > >> > > > >> > > > > UserManager um = userManagerFactory.createUserManager(); >> > > > >> > > > um.save(user); >> > > > >> > > > serverFactory.setUserManager(um); >> > > > >> > > > >> > > > > FtpServer server = serverFactory.createServer(); >> > > > >> > > > server.start(); >> > > > >> > > > >> > > > Test creating a dir: >> > > > >> > > > > ftp> mkdir test >> > > > >> > > > 550 Can't create directory /test. >> > > > >> > > > >> > > > Test uploading file: >> > > > >> > > > > ftp> send >> > > > >> > > > Arquivo local c:/a.rar >> > > > >> > > > Arquivo remoto a.rar >> > > > >> > > > 200 Command PORT okay. >> > > > >> > > > 150 File status okay; about to open data connection. >> > > > >> > > > 551 /a.rar: Error on output file. >> > > > >> > > > >> > > > Any ideas ? >> > > > Thanks a lot, >> > > > >> > > > On Sun, Oct 17, 2010 at 7:22 PM, Frank van der Kleij < >> [email protected] >> > > >wrote: >> > > > >> > > > > >> > > > > Another option - though one that gives you slightly less control >> is to >> > > use >> > > > > the VFS filesystem plugin for the FTP server ( >> > > > > http://vfs-utils.sourceforge.net/ftpserver/index.html) because >> then >> > > you >> > > > > can use the ram:// filesystem ( >> > > > > http://commons.apache.org/vfs/filesystems.html#ram) that works on >> > > > > memory.Frank >> > > > > > Date: Fri, 15 Oct 2010 17:26:40 +0200 >> > > > > > Subject: Re: FtpServer - Receive files by memory >> > > > > > From: [email protected] >> > > > > > To: [email protected] >> > > > > > >> > > > > > 2010/10/15 Danilo Rosetto Muñoz <[email protected]>: >> > > > > > > I would like to know some way to get FTP received files >> directly >> > > from >> > > > > > > memory. I mean redirect file transfers to the memory and >> listening >> > > > > them. I >> > > > > > > want this in order to embbeded a FTP Server on my app and >> handling >> > > new >> > > > > > > files through memory without using filesystem. >> > > > > > >> > > > > > The best way of doing this would be using an in-memory file >> system >> > > > > > (implementing FileSystemFactory, FileSystemView and FtpFile). We >> do >> > > > > > not supply one, but it would certainly be possible to implement >> one. >> > > > > > >> > > > > > /niklas >> > > > > >> > > > > >> > > > >> > > > >> > > > >> > > > -- >> > > > Danilo Rosetto Muñoz >> > > > [email protected] >> > > > http://munozdanilo.googlepages.com >> > > >> > > >> > >> > >> > >> > -- >> > Danilo Rosetto Muñoz >> > [email protected] >> > http://munozdanilo.googlepages.com >> >> > > > > -- > Danilo Rosetto Muñoz > [email protected] > http://munozdanilo.googlepages.com > -- Danilo Rosetto Muñoz [email protected] http://munozdanilo.googlepages.com
