嵌入式Apache FTP服务器的身份验证失败(错误530)

时间:2010-06-27 12:52:28

标签: java linux apache ftp

我在我的java网络应用程序中嵌入了apache ftpserver,我尝试了几个不同的东西,每当我尝试通过FTP连接到服务器时,它说身份验证失败了。当我尝试登录时,我附加了我的代码和控制台输出。有没有人有任何建议?我尝试在OS X和Centos Linux上运行它。

PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
userManagerFactory.setFile(new File("/ftpdata/myusers.properties"));
//userManagerFactory.setPasswordEncryptor(new SaltedPasswordEncryptor());
userManagerFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
UserManager um = userManagerFactory.createUserManager();
BaseUser user = new BaseUser();
user.setName("andy");
user.setPassword("12345678");
user.setHomeDirectory("/ftpdata/");
um.save(user);

FtpServerFactory serverFactory = new FtpServerFactory();
ListenerFactory factory = new ListenerFactory();
factory.setPort(2225);
serverFactory.addListener("default", factory.createListener());
FtpServer server = serverFactory.createServer();
server.start();








12:03:28,768 INFO  [STDOUT] 12:03:28,768 INFO  [DefaultFtpServer] FTP server started
12:04:14,200 INFO  [STDOUT] 12:04:14,200 INFO  [FtpLoggingFilter] CREATED
12:04:14,208 INFO  [STDOUT] 12:04:14,208 INFO  [FtpLoggingFilter] OPENED
12:04:14,228 INFO  [STDOUT] 12:04:14,228 INFO  [FtpLoggingFilter] RECEIVED: USER andy
12:04:14,230 INFO  [STDOUT] 12:04:14,230 INFO  [FtpLoggingFilter] SENT: 220 Service ready for new user.
12:04:14,232 INFO  [STDOUT] 12:04:14,232 INFO  [FtpLoggingFilter] SENT: 331 User name okay, need password for andy.
12:04:14,233 INFO  [STDOUT] 12:04:14,233 INFO  [FtpLoggingFilter] RECEIVED: PASS *****
12:04:14,236 INFO  [STDOUT] 12:04:14,236 WARN  [PASS] User failed to log in
12:04:14,736 INFO  [STDOUT] 12:04:14,736 WARN  [PASS] Login failure - andy
12:04:14,740 INFO  [STDOUT] 12:04:14,740 INFO  [FtpLoggingFilter] RECEIVED: QUIT
12:04:14,746 INFO  [STDOUT] 12:04:14,746 INFO  [FtpLoggingFilter] SENT: 530 Authentication failed.
12:04:14,746 INFO  [STDOUT] 12:04:14,746 INFO  [FtpLoggingFilter] SENT: 221 Goodbye.
12:04:14,747 INFO  [STDOUT] 12:04:14,746 INFO  [FtpLoggingFilter] CLOSED

1 个答案:

答案 0 :(得分:3)

我的问题可能听起来很愚蠢但是 我可以在日志中看到

12:04:14,233 INFO [STDOUT] 12:04:14,233 INFO [FtpLoggingFilter]收到:PASS *****

这些是5星,密码长度是8:D

我可以看到你传递了一个属性文件,那么你有没有密码?

最后,你创建一个UserManager,你不必在某个地方传递这个对象吗?