Thread: [JSch-users] jsch sftp without password
Status: Alpha
Brought to you by:
ymnk
From: karim a. <kar...@gm...> - 2006-02-17 23:47:25
|
Hi We are implementing a java based application which shall perform bunch of sftp. I found out jsch as free ssh implementation. So far authentication was using password but we've been asked to use public key authentication. From the test we did, it does not work when it is fine for a command line sftp. Here is what we do: the java app is running under user1. I created a key with ssh-keygen for user1 stored in ~user1/.ssh the public key has been stored in ~user2/.ssh/authorized_keys on the remote machine, I checked permission and owner of all .ssh, id_rsa, id_rsa.pub and authorized_keys and it still does not work. There is not that much doc on how to use jsch and for the different configuration especially working without password. Does anybody has to face the same issue? I'm in trouble and really running out of time so I would appreciate all the help you could provide me with Best regards Karim |
From: <ym...@jc...> - 2006-02-18 14:13:27
|
Hi, +-From: "karim aklouche" <kar...@gm...> -- |_Date: Sat, 18 Feb 2006 00:47:22 +0100 ______________ | |I'm in trouble and really running out of time so I would appreciate all the |help you could provide me with Please refer to examples/UserAuthPubKey.java . JSch jsch=new JSch(); //jsch.addIdentity("absolute path of private key"); jsch.addIdentity("/home/user1/.ssh/id_rsa"); Session session=jsch.getSession(user, host, 22); ... Sincerely, -- Atsuhiko Yamanaka JCraft,Inc. 4-1 OHMACHI 1-CHOME AOBA-KU, SENDAI, MIYAGI 980-0804 Japan. Tel +81-22-723-2150 +1-415-578-3454 Fax +81-22-224-8773 Skype callto://jcraft/ |
From: Vijay S. <vij...@gm...> - 2006-02-21 02:49:39
|
Hey Karim, Make sure the authorized_keys file has just read permission only for user/group and others. Otherwise the public key auth does not work. Regards Vijay On 2/18/06, Atsuhiko Yamanaka <ym...@jc...> wrote: > Hi, > > +-From: "karim aklouche" <kar...@gm...> -- > |_Date: Sat, 18 Feb 2006 00:47:22 +0100 ______________ > | > |I'm in trouble and really running out of time so I would appreciate al= l the > |help you could provide me with > > Please refer to examples/UserAuthPubKey.java . > > JSch jsch=3Dnew JSch(); > //jsch.addIdentity("absolute path of private key"); > jsch.addIdentity("/home/user1/.ssh/id_rsa"); > Session session=3Djsch.getSession(user, host, 22); > ... > > > Sincerely, > -- > Atsuhiko Yamanaka > JCraft,Inc. > 4-1 OHMACHI 1-CHOME AOBA-KU, > SENDAI, MIYAGI 980-0804 Japan. > Tel +81-22-723-2150 > +1-415-578-3454 > Fax +81-22-224-8773 > Skype callto://jcraft/ > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > JSch-users mailing list > JSc...@li... > https://lists.sourceforge.net/lists/listinfo/jsch-users > |
From: karim a. <kar...@gm...> - 2006-02-21 08:05:15
|
Hi guys Thanks to Atsuhiko, we succeeded to make it work Most of the problems were because we were new with SSH and some other problems related to our design. That could be great if we could have a small FAQ or any other tutorial on Jsch in order not to waste your time. The API is great and tremendeously helped us and havig such reactive support in case of trouble is simply great. Thanks once again regards Karim - Ericsson France On 2/21/06, Vijay Shah <vij...@gm...> wrote: > > Hey Karim, > > Make sure the authorized_keys file has just read permission only for > user/group and others. Otherwise the public key auth does not work. > > Regards > Vijay > > > On 2/18/06, Atsuhiko Yamanaka <ym...@jc...> wrote: > > Hi, > > > > +-From: "karim aklouche" <kar...@gm...> -- > > |_Date: Sat, 18 Feb 2006 00:47:22 +0100 ______________ > > | > > |I'm in trouble and really running out of time so I would appreciate > all the > > |help you could provide me with > > > > Please refer to examples/UserAuthPubKey.java . > > > > JSch jsch=3Dnew JSch(); > > //jsch.addIdentity("absolute path of private key"); > > jsch.addIdentity("/home/user1/.ssh/id_rsa"); > > Session session=3Djsch.getSession(user, host, 22); > > ... > > > > > > Sincerely, > > -- > > Atsuhiko Yamanaka > > JCraft,Inc. > > 4-1 OHMACHI 1-CHOME AOBA-KU, > > SENDAI, MIYAGI 980-0804 Japan. > > Tel +81-22-723-2150 > > +1-415-578-3454 > > Fax +81-22-224-8773 > > Skype callto://jcraft/ > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > > _______________________________________________ > > JSch-users mailing list > > JSc...@li... > > https://lists.sourceforge.net/lists/listinfo/jsch-users > > > |
From: Heiner W. <Hei...@He...> - 2006-02-21 08:07:13
|
Vijay and Karim, to be precise neither group nor others may have write access to the authorized_key file, else opensshd will refuse to use it. I.e. the permissions may be anywhere between -rw-r--r-- and -r--------. Don't know the constraints of freeSSHd and friends. I do have write access (0600) to my .ssh/authorized_keys2 and it works like a charm. Have fun, Heiner Vijay Shah schrieb: > Hey Karim, > > Make sure the authorized_keys file has just read permission only for > user/group and others. Otherwise the public key auth does not work. > > Regards > Vijay > > > On 2/18/06, Atsuhiko Yamanaka <ym...@jc...> wrote: >> Hi, >> >> +-From: "karim aklouche" <kar...@gm...> -- >> |_Date: Sat, 18 Feb 2006 00:47:22 +0100 ______________ >> | >> |I'm in trouble and really running out of time so I would appreciate all the >> |help you could provide me with >> >> Please refer to examples/UserAuthPubKey.java . >> >> JSch jsch=new JSch(); >> //jsch.addIdentity("absolute path of private key"); >> jsch.addIdentity("/home/user1/.ssh/id_rsa"); >> Session session=jsch.getSession(user, host, 22); >> ... >> >> >> Sincerely, >> -- >> Atsuhiko Yamanaka >> JCraft,Inc. >> 4-1 OHMACHI 1-CHOME AOBA-KU, >> SENDAI, MIYAGI 980-0804 Japan. >> Tel +81-22-723-2150 >> +1-415-578-3454 >> Fax +81-22-224-8773 >> Skype callto://jcraft/ >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files >> for problems? Stop! Download the new AJAX search engine that makes >> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 >> _______________________________________________ >> JSch-users mailing list >> JSc...@li... >> https://lists.sourceforge.net/lists/listinfo/jsch-users >> > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642 > _______________________________________________ > JSch-users mailing list > JSc...@li... > https://lists.sourceforge.net/lists/listinfo/jsch-users > -- Heiner Westphal Mail : wes...@he... Peter-Michely Str. 18 Tel. : +49-(0)681-5847703 D-66117 Saarbrücken Mobil: +49-(0)177-5752640 |