Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

issue with sshxcute while connecting to a linux server

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

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

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.

    Bookmark Topic Watch Topic
  • New Topic