• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Java program sshing to Linux Server

 
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to write a java program and eventually a web app to do the following.

1. get the server name, username, password from the user and ssh to the linux box.

2. goto a folder, open a script file (the file has different function calls, I need to comment all other function calls and just un-comment the one I want to use)

#call_1
call_2
#call_3
#call_4

I know it should always use the call_2 for this, but other programs or users can comment/uncomment these calls. So I need to make sure of it.

3. Execute the nohup command to run the script
4. May be (this is to be decided) send an email once its done.

I think we can do this from a java program, but not sure about the step 2. Do we need a script for that?

I started using JSch - Java Secure Channel, but I get "com.jcraft.jsch.JSchException: Auth fail". I found that I need to change /etc/ssh/sshd_config file. But for me that is not an option because of compliance issues. So how else can I go about this.

Any help is appreciated. Thanks.
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic