Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.6k views
in Java FTP by (210 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.setRemoteHost(hostName);
    m_SFTP.setRemotePort(port);
    m_SFTP.setAuthentication(userName, null);
    
    System.out.println("Turning off server validation");
    m_SFTP.getValidator().setHostValidationEnabled(false);
    m_SFTP.connect();
    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 (51.6k points)
I think you forgot to include the exception that you got.  Can you please add it?
by (210 points)
I updated my post with exception. Please review .
by (162k points)
I just tried using the empty string for a user with no password and it worked fine.

1 Answer

0 votes
by (162k 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 (210 points)
How to get latest version. Please share link.
by (162k 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.
by (210 points)
reshown by
I facing same issue even after using version 7.1.0. Please suggest what we need to do for login into sftp server with empty password ("").

Categories

...