Discuss (FTP) and (SFTP, FTPS and SCP), our Java file transfer clients.
no avatar
User

haiping

Posts

1

Joined

Tue Aug 26, 2008 10:34 am

Could not authenticate SSH client

by haiping » Tue Aug 26, 2008 10:55 am

I am testing a simple SSHFTPClient based client using public-key authentication. The client authentication seems okay but connection always failed due to the exception. Any ideas?

try {
// create client
log.info("Creating SFTP client");
SSHFTPClient ftp = new SSHFTPClient();
ftp.setRemotePort(21);

// set remote host
ftp.setRemoteHost("lcoalhost");

// turn off server validation
ftp.getValidator().setHostValidationEnabled(false);

log.info("Setting user-name and password");
ftp.setAuthentication("C:\\Test\\keys\\test.priv.ssh", "test", "testtest");

// connect to the server
ftp.connect();

log.info("Setting transfer mode to ASCII");
ftp.setType(FTPTransferType.ASCII);

// Shut down client
log.info("Quitting client");
ftp.quit();

log.info("Example complete");

} catch (Exception e) {
e.printStackTrace();
}

>>
DEBUG [SSHFTPClient] 25 Aug 2008 17:41:10.101 : Created SFTP client.
INFO [SFTPClient] 25 Aug 2008 17:41:10.101 : Setting user-name and password
DEBUG [SshPrivateKeyFile] 25 Aug 2008 17:41:10.116 : Parsing private key file
DEBUG [SshPrivateKeyFormatFactory] 25 Aug 2008 17:41:10.116 : Loading private key formats
DEBUG [SshPrivateKeyFormatFactory] 25 Aug 2008 17:41:10.132 : Installing OpenSSH-PrivateKey private key format
DEBUG [SshPrivateKeyFormatFactory] 25 Aug 2008 17:41:10.132 : Installing SSH.COM-PrivateKey-Base64Encoded private key format
DEBUG [SshPrivateKeyFormatFactory] 25 Aug 2008 17:41:10.148 : Installing PuTTY-User-Key-File-2 private key format
DEBUG [SshPrivateKeyFormatFactory] 25 Aug 2008 17:41:10.148 : Installing SSHTools-PrivateKey-Base64Encoded private key format
DEBUG [SshPrivateKeyFile] 25 Aug 2008 17:41:10.163 : Private key is not in the default format, attempting parse with other supported formats
DEBUG [SshPrivateKeyFile] 25 Aug 2008 17:41:10.163 : Attempting OpenSSH-PrivateKey
DEBUG [SshPrivateKeyFile] 25 Aug 2008 17:41:10.163 : Attempting SSH.COM-PrivateKey-Base64Encoded
INFO [SshDotComPrivateKeyFormat] 25 Aug 2008 17:41:10.163 : Unpacking ssh.com formatted private key
DEBUG [IJCE_Properties] 25 Aug 2008 17:41:10.195 : Successfully loaded the IJCE properties file
INFO [cryptix] 25 Aug 2008 17:41:10.241 : GLOBAL_TRACE=false
INFO [cryptix] 25 Aug 2008 17:41:10.241 : GLOBAL_DEBUG=false
INFO [cryptix] 25 Aug 2008 17:41:10.241 : GLOBAL_DEBUG_SLOW=false
INFO [SshDotComPrivateKeyFormat] 25 Aug 2008 17:41:10.273 : RSA private key
INFO [SFTPClient] 25 Aug 2008 17:41:10.288 : Connecting to server localhost
INFO [SCPClient] 25 Aug 2008 17:41:10.288 : SCPClient settings validated.
DEBUG [SCPClient] 25 Aug 2008 17:41:10.288 : Connecting to localhost:21
DEBUG [TransportProviderFactory] 25 Aug 2008 17:41:10.304 : Connecting to localhost:21 via standard socket
DEBUG [SocketTransportProvider] 25 Aug 2008 17:41:10.304 : Invoking connect with timeout=60000
INFO [TransportProtocolCommon] 25 Aug 2008 17:41:10.351 : Timeout=60000
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.351 : Starting transport protocol
INFO [TransportProtocolCommon] 25 Aug 2008 17:41:10.351 : Wait for state update timeout=60000
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.351 : Registering transport protocol messages with inputstream
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.398 : Negotiating protocol version
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.398 : Local identification: SSH-2.0-edtFTPjPRO-2.0.1
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.413 : EOL is guessed at CR+LF
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.413 : Remote identification: 'SSH-2.0-CoreFTP-0.1.2'
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.413 : Protocol negotiation complete
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.413 : Sending SSH_MSG_KEX_INIT
DEBUG [SshMsgKexInit] 25 Aug 2008 17:41:10.429 : Packetlength=452, Paddinglength=4
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Received registered message: SSH_MSG_KEX_INIT
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Received remote key exchange init message
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Starting key exchange
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Determine Algorithm
INFO [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Wait for state update timeout=60000
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Client Algorithms: [diffie-hellman-group1-sha1]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Server Algorithms: [diffie-hellman-group1-sha1, diffie-hellman-group14-sha1]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Returning diffie-hellman-group1-sha1
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.429 : Key exchange algorithm: diffie-hellman-group1-sha1
INFO [DhGroup1Sha1] 25 Aug 2008 17:41:10.429 : Starting client side key exchange.
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:10.476 : Sending SSH_MSG_KEXDH_INIT
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.85 : Received unregistered message: SSH_MSG_KEXDH_REPLY
DEBUG [DhGroup1Sha1] 25 Aug 2008 17:41:11.132 : calculateExchangeHash()
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.132 : Verifying host [localhost]:21,[127.0.0.1]:21
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.148 : Preferred algorithm null
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.148 : Determine Algorithm
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.148 : Client Algorithms: [ssh-dss, ssh-rsa]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.148 : Server Algorithms: [ssh-rsa]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.148 : Returning ssh-rsa
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.148 : Selected algorithm ssh-rsa
DEBUG [SshRsaPublicKey] 25 Aug 2008 17:41:11.148 : Signature length=143
DEBUG [SshRsaPublicKey] 25 Aug 2008 17:41:11.226 : Verifying signature (com.enterprisedt.cryptix.provider.rsa.SHA1_RSA_PKCS1Signature)
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Sending SSH_MSG_NEWKEYS
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Received registered message: SSH_MSG_NEWKEYS
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Completing key exchange
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Making keys from key exchange output
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Creating algorithm objects
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Determine Algorithm
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Client Algorithms: [3des-cbc, aes128-cbc, aes256-cbc, blowfish-cbc, aes192-cbc]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Server Algorithms: [aes128-cbc, 3des-cbc, blowfish-cbc, aes192-cbc, aes256-cbc, rijndael128-cbc, rijndael192-cbc, rijndael256-cbc, rijndael-cbc@lysator.liu.se]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.273 : Returning 3des-cbc
DEBUG [com.enterprisedt.net.j2ssh.transport.cipher.SshCipherFactory] 25 Aug 2008 17:41:11.273 : Creating new 3des-cbc cipher instance
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Determine Algorithm
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Client Algorithms: [3des-cbc, aes128-cbc, aes256-cbc, blowfish-cbc, aes192-cbc]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Server Algorithms: [aes128-cbc, 3des-cbc, blowfish-cbc, aes192-cbc, aes256-cbc, rijndael128-cbc, rijndael192-cbc, rijndael256-cbc, rijndael-cbc@lysator.liu.se]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Returning 3des-cbc
DEBUG [com.enterprisedt.net.j2ssh.transport.cipher.SshCipherFactory] 25 Aug 2008 17:41:11.288 : Creating new 3des-cbc cipher instance
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Determine Algorithm
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Client Algorithms: [hmac-sha1, hmac-md5-96, hmac-md5, hmac-sha1-96]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Server Algorithms: [hmac-sha1, hmac-md5, none]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Returning hmac-sha1
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Determine Algorithm
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Client Algorithms: [hmac-sha1, hmac-md5-96, hmac-md5, hmac-sha1-96]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Server Algorithms: [hmac-sha1, hmac-md5, none]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Returning hmac-sha1
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Determine Algorithm
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Client Algorithms: [none, zlib]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Server Algorithms: [none, none]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Returning none
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Determine Algorithm
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Client Algorithms: [none, zlib]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Server Algorithms: [none, none]
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Returning none
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.288 : Sending queued messages
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.304 : Sending SSH_MSG_SERVICE_REQUEST
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.304 : Received unregistered message: SSH_MSG_SERVICE_ACCEPT
DEBUG [SCPClient] 25 Aug 2008 17:41:11.320 : Connected ok - authenticating
DEBUG [com.enterprisedt.net.j2ssh.authentication.PublicKeyAuthenticationClient] 25 Aug 2008 17:41:11.320 : Generating data to sign
DEBUG [com.enterprisedt.net.j2ssh.authentication.PublicKeyAuthenticationClient] 25 Aug 2008 17:41:11.320 : Preparing public key authentication request
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.382 : Sending SSH_MSG_USERAUTH_REQUEST
DEBUG [TransportProtocolCommon] 25 Aug 2008 17:41:11.382 : Received unregistered message: SSH_MSG_USERAUTH_FAILURE
com.enterprisedt.net.ftp.ssh.SSHFTPException: Could not authenticate SSH client: FAILED
at com.enterprisedt.net.ftp.ssh.SCPClient.connectSSH(Unknown Source)
at com.enterprisedt.net.ftp.ssh.SSHFTPClient.connect(Unknown Source)
at SFTPClient.main(SFTPClient.java:56)

Who is online

Users browsing this forum: No registered users and 15 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron