Unable to Authenticate

Help
2010-05-03
2013-05-20
  •  Mohana Eemeli

    Mohana Eemeli - 2010-05-03

    I'm using 0.2.7 because 0.2.9 seems to need java/util/concurrent/ConcurrentHashMap (jdk 5.0) and I'm stuck to 1.4.2

    I'm getting com.sshtools.j2ssh.authentication.AuthenticationProtocolException: Failed to read messages
    using the passwordAuthenticationClient
    (server = SSH-2.0-mod_sftp/0.9.7)

    Anything I can do?

     
  • Pat

    Pat - 2010-05-03

    A stack trace with source line numbers and a log is needed.

     
  •  Mohana Eemeli

    Mohana Eemeli - 2010-05-04

    Stack trace:

    com.sshtools.j2ssh.authentication.AuthenticationProtocolException: Failed to read messages
        at com.sshtools.j2ssh.authentication.AuthenticationProtocolClient.internalReadMessage(Unknown Source)
        at com.sshtools.j2ssh.authentication.AuthenticationProtocolClient.readMessage(Unknown Source)
        at com.sshtools.j2ssh.authentication.PasswordAuthenticationClient.authenticate(Unknown Source)
        at com.sshtools.j2ssh.authentication.AuthenticationProtocolClient.authenticate(Unknown Source)
        at com.sshtools.j2ssh.SshClient.authenticate(Unknown Source)
    

    The exception is thrown on sshClient.authenticate(…..)

        SshClient sshClient = null;
        try {
          sshClient = new SshClient();
          sshClient.connect(hostname, port);
          logger.debug(sshClient.getServerId());
          logger.debug(sshClient.getServerHostKey());
          sshClient.acceptsKey(sshClient.getServerId(), sshClient.getServerHostKey());
          PasswordAuthenticationClient passwordAuthenticationClient = new PasswordAuthenticationClient();
          passwordAuthenticationClient.setUsername(username);
          passwordAuthenticationClient.setPassword(password);
          sshClient.authenticate(passwordAuthenticationClient);
          SftpClient sftp = sshClient.openSftpClient();
          sftp.lcd("/");
        }
        finally {
          if (sshClient != null) {
            sshClient.disconnect();
          }
        }
    
     
  •  Mohana Eemeli

    Mohana Eemeli - 2010-05-04

    Oh, the logging that I have on this is:
    SSH-2.0-mod_sftp/0.9.7
    com.sshtools.j2ssh.transport.publickey.dsa.SshDssPublicKey@da9939fd

     
  •  Mohana Eemeli

    Mohana Eemeli - 2010-05-04

    I turned on the debug logging on sshtools itself, I'm not sure if you want it all. I'm posting the authentication part:

    2010-05-04 17:58:46,203 INFO  [main] authentication.PublicKeyAuthenticationClient  - Determining if server can accept public key for authentication
    2010-05-04 17:58:46,203 INFO  [main] transport.TransportProtocolCommon  - Sending SSH_MSG_USERAUTH_REQUEST
    2010-05-04 17:58:46,243 DEBUG [Transport protocol 1] transport.TransportProtocolCommon  - Received SSH_MSG_IGNORE
    2010-05-04 17:58:46,243 DEBUG [Transport protocol 1] transport.TransportProtocolCommon  - SSH_MSG_IGNORE with 137 bytes of data
    2010-05-04 17:58:46,243 INFO  [Transport protocol 1] transport.TransportProtocolCommon  - Received SSH_MSG_USERAUTH_FAILURE
    2010-05-04 17:58:46,243 INFO  [main] transport.TransportProtocolCommon  - Sending SSH_MSG_USERAUTH_REQUEST
    2010-05-04 17:58:46,283 DEBUG [Transport protocol 1] transport.TransportProtocolCommon  - Received SSH_MSG_IGNORE
    2010-05-04 17:58:46,283 DEBUG [Transport protocol 1] transport.TransportProtocolCommon  - SSH_MSG_IGNORE with 74 bytes of data
    2010-05-04 17:58:46,283 DEBUG [Transport protocol 1] transport.TransportProtocolCommon  - Received SSH_MSG_DISCONNECT
    2010-05-04 17:58:46,283 INFO  [Transport protocol 1] transport.TransportProtocolCommon  - The remote computer disconnected: Protocol error
    2010-05-04 17:58:46,283 DEBUG [Transport protocol 1] transport.TransportProtocolCommon  - The Transport Protocol has been stopped
    2010-05-04 17:58:46,283 DEBUG [main] transport.TransportProtocolCommon  - Disconnect: Terminating connection
    2010-05-04 17:58:46,283 INFO  [main] transport.TransportProtocolCommon  - Sending SSH_MSG_DISCONNECT
    
     
  •  Mohana Eemeli

    Mohana Eemeli - 2010-05-04

    It appears that if I don't do:

    sshClient.acceptsKey(........);
    

    it executes without error. I guess that code bit is awkward anyway.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks