Hi,

Sorry for my delayed responses.
# We are still in the earthquake disasters,
# and there are not enough foods(especially fresh foods).
# So, everyday, I must be in the long long queue for foods 
# for my family with the fears for radioactive materials.
 
   +-From: Koundinya Srinivasarao <ksrinivasa...@opnet.com> --
   |_Date: Mon, 21 Mar 2011 11:16:15 -0400 ___________________
   |
   |You can ssh from A to B or C and then run scp between them. 
   |Hope that helps.

Koundinya, thank you for your followup.
Let me allow to add one more tips. I mean that how about using the 
agent forwarding in that scenario.

Suppose that you have a private key "~/.ssh/id_foo" on A and
its public key has been included in ~/.ssh/authorized_keys of B and C.
So, running following chunk of code on A,

  JSch jsch=new JSch();
  jsch.addIdentity("/home/ymnk/.ssh/id_foo", "passphrase for id_foo");

  String host = "B";
  String user = "foo";
  Session session=jsch.getSession(user, host, 22);

  UserInfo ui=new MyUserInfo();
  session.setUserInfo(ui);

  session.connect();

  String command="scp /tmp/some_file foo@C:/tmp/";

  Channel channel=session.openChannel("exec");
  ((ChannelExec)channel).setCommand(command);
  ((ChannelExec)channel).setAgentForwarding(true);
  ...
  channel.connect(); 
  ...


Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
    +1-415-578-3454
Skype callto://jcraft/
Twitter: http://twitter.com/ymnk

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to