Hi,

   +-From: "Benjamin L. May" <bl...@columbia.edu> --
   |_Date: Tue, 22 May 2012 15:10:33 -0400 (EDT) __
   |
   |I am trying to use an SSH key with Jsch to copy a file via SFTP from one
   |machine to another. On the remote machine I have done:
   |
   |$ssh-keygen -t rsa
   |<hit enter twice for blank passphrase>
   |
   |I then end up with id_rsa and id_rsa.pub inside .ssh on the remote
   |machine.

Have you appended 'id_rsa.pub' to '~/.ssh/authorized_keys' on the remote,
and taken care for its file permission?

  $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  $ chmod go-rwx ~/.ssh/authorized_keys

Try the following example on the local to check if the remote settings
works well,
  http://www.jcraft.com/jsch/examples/UserAuthPubKey.java.html

And then, you don't have to locate 'id_rsa' on the remote.
It is the secrete.  If there is not the strong requirements to do so,
you should not.

   |      I copy these files to the local machine, which is where the java
   |program is running. This is my code:
   |
   |  static public final String sshuser = "<redacted>";
   |  static public final String sshhost = "<redacted>";
   |  static public final String privatesshkey = "id_rsa";

If your code does not work, how about setting the abolute path of 'id_rsa'?

      static public final String privatesshkey = "/home/name/.ssh/id_rsa";


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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to