problem description
Using FtpClient to connect to the server getReplyCode () injava returns 530, but it is normal to connect using the SSH tool.
the environmental background of the problems and what methods you have tried
you have a FTP server IP and account password in hand. The same account password can be logged in using the SSH tool (port: 22), but the FtpClient method of apache.commons.net.ftp.FTPClient is called in java. Port 21 is used. Through the information seen in the source code, the replyCode obtained from a login method that comes with FtpClient is 530. Using isPositiveCompletion () also returned false. Try to connect to another FTP server and get normal results. Here is the information returned by both telnet servers. (there is nothing wrong with the code, after all, it is the package method of apache.)
servers that FTPClient cannot log in are shown in the following figure :
FTPClient:
login(user_list,ftpuser,vaftpd.conf)
related codes
/ / Please paste the code text below (do not replace the code with pictures)
private static String hostname = "**.***.***.**";
private static int port = 21;
private static String username = "root";
private static String pass = "rootroot";
FTPClient ftpClient = new FTPClient();
logger.debug("FTP-DETAILS-");
ftpClient.connect(hostname, port);
int reply = ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
ftpClient.disconnect();
}
//
boolean b = ftpClient.login("root", "rootroot");
int test = ftpClient.getReplyCode(); //->530
what result do you expect? What is the error message actually seen?
replyCode=530