Discussion:
[JSch-users] Authentication with password & key
Răzvan Rotaru
2016-10-14 15:49:45 UTC
Permalink
Hi Jsch community,

I am looking to use both password and key authentication in a single
connect call, so that
the password authentication is used as backup in case the key
authentication fails.

Adding the key with Jsch.addIdentity and password with Session.setUserInfo
does not yield this behaviour. Of course I could call Session.connect
twice, but I am wondering whether Jsch supports this.

Many thanks,
Razvan
Vikas Verma
2016-10-14 16:39:30 UTC
Permalink
Have you tried

config.put("PreferredAuthentications", "publickey,keyboard-interactive,password");

________________________________
From: Rãzvan Rotaru <***@gmail.com>
Sent: Friday, October 14, 2016 11:49:45 AM
To: jsch-***@lists.sourceforge.net
Subject: [JSch-users] Authentication with password & key

Hi Jsch community,

I am looking to use both password and key authentication in a single connect call, so that
the password authentication is used as backup in case the key authentication fails.

Adding the key with Jsch.addIdentity and password with Session.setUserInfo does not yield this behaviour. Of course I could call Session.connect twice, but I am wondering whether Jsch supports this.

Many thanks,
Razvan

Loading...