posted 9 years ago
Hi,
I am trying the Google's sshxcute framework to connect to a linux server to execute some commands without the need for manual intervention via putty.
When i login to the server via putty i can login successfully but the same fails when executing via the code. The code is as below and this is just the same as the sample code on the Google's sshxcute
//******************
// Initialize a ConnBean object, parameter list is ip, username, password
ConnBean cb = new ConnBean("ip address", "username","password");
// Put the ConnBean instance as parameter for SSHExec static method getInstance(ConnBean) to retrieve a singleton SSHExec instance
ssh = SSHExec.getInstance(cb);
// Connect to server
ssh.connect();
//************************
The logs say this
SSHExec initializing ...
Session initialized and associated with user credential <password>
SSHExec initialized successfully
SSHExec trying to connect myloginid@hostname
Connect fails with the following exception: com.jcraft.jsch.JSchException: Auth fail
false
I am not sure if this is due to not caching the public key of the server when one connects to the server for the first time (as it happens in putty) or is it that the server is only allowing keyboard interactive sessions i am not sure.
kindly suggest how to enable the saving of the public key feature if that is the real issue.