aspose file tools*
The moose likes Java in General and the fly likes Java program sshing to Linux Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java program sshing to Linux Server" Watch "Java program sshing to Linux Server" New topic
Author

Java program sshing to Linux Server

vjy chin
Ranch Hand

Joined: Feb 17, 2005
Posts: 279
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java program sshing to Linux Server