Results 1 to 1 of 1
Thread: GanyMed-SSH2 & Script SFTP
- 03-16-2012, 03:53 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 1
- Rep Power
- 0
GanyMed-SSH2 & Script SFTP
Hello
There is my situation.
I want to get connected to a Server Ubuntu (let's call it Server 1) and run a script which contains sftp commands that transfers a file to a second Server (server 2).
When I am on Server 1 I can run the script and the transfer is done, but when I am using my java application with Ganymed-SSH2 to get connected to Server 1 and run the script I get Commande exitStatus 255.
When I use putty to get connected to Server 1 and run the script, I'm asked to give the passphrase even if I copied the passphrase in "authorized_keys" of Server 2.
There is the script I run:
And this is the java code I'm using:Java Code:#!/bin/sh #!/usr/ sftp login@server <<EOF put file quit EOF
Java Code:Connection connection=new Connection("SERVEUR"); try { connection.connect(); connection.authenticateWithPassword("login", "password"); System.out.println("Connection Established"); } catch (IOException e) { // TODO Auto-generated catch block System.out.println("Connection Failed"); e.printStackTrace(); } Session session=connection.openSession(); session.execCommand("./script"); System.out.println( "ExitCode: " + session.getExitStatus() ); session.close();
Hope someone can help me.
Similar Threads
-
SSH Connection with host linux "ganymed"
By guybrush_84 in forum Advanced JavaReplies: 0Last Post: 08-03-2011, 11:51 AM -
Java Download from SFTP
By hardcorebadger in forum New To JavaReplies: 3Last Post: 01-21-2011, 03:49 PM -
sftp Authentication
By suprimcy in forum New To JavaReplies: 2Last Post: 06-01-2010, 12:49 AM -
SFTP applet (SSH FTP)
By jfileupload in forum Java SoftwareReplies: 1Last Post: 02-26-2009, 10:31 PM -
Rad SFTP Applet 2.01
By levent in forum Java SoftwareReplies: 0Last Post: 05-22-2007, 06:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks