Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
in Java FTP by (140 points)
edited by

I need to connect with the sftp host without password. For that I have passed null as password and "" empty string as password. In both case i got below exception. But using putty I am able to connect with SFTP host without password . Kindly guide me connect with SFTP.

public void login(String hostName, int port, String userName, String password)
  throws Exception
  try {
    SSHFTPClient m_SFTP = new SSHFTPClient();
    m_SFTP.setAuthentication(userName, null);
    System.out.println("Turning off server validation");
    System.out.println("FTPProcessHandlerSFTFact login  :'" + m_SFTP.connected() +"'");
  } catch (Exception e) {
    setReply("4", e.getMessage());
    throw e;
Exception : 
com.enterprisedt.net.ftp.ssh.SSHFTPException: Could not authenticate SSH client: FAILED
	at com.enterprisedt.net.ftp.ssh.SCPClient.connectSSH(SCPClient.java:1152) ~[edtftpj-pro.jar:na]
	at com.enterprisedt.net.ftp.ssh.SSHFTPClient.connect(SSHFTPClient.java:920) ~[edtftpj-pro.jar:na]
by (44.4k points)
I think you forgot to include the exception that you got.  Can you please add it?
by (140 points)
I updated my post with exception. Please review .
by (153k points)
I just tried using the empty string for a user with no password and it worked fine.

1 Answer

0 votes
by (153k points)
We have tried setting the empty string for the password and it works fine. Make sure you are using the latest version though.
by (140 points)
How to get latest version. Please share link.
by (153k points)
For the latest version you'll need to login to our customer support site, see https://connect.enterprisedt.com.  You should have a username, and you can reset your password if you don't have it.