Comment 3 for bug 1522190

Revision history for this message
jean-christophe manciot (manciot-jeanchristophe) wrote : Re: Permission denied (publickey) whereas the public key has been inserted into ~/.ssh/authorized_keys

We have a winner: setting usePAM to no generates the issue:
/etc/ssh/sshd_config
-------------------------------
...
usePAM no

ChallengeResponseAuthentication no
PasswordAuthentication no
PermitEmptyPasswords no
...

ssh -v root@localhost
---------------------------------
...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Offering ED25519 public key: /root/.ssh/id_ed25519
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

However, setting usePAM to yes makes the session work:
/etc/ssh/sshd_config
-------------------------------
...
use PAM yes

ChallengeResponseAuthentication no
PasswordAuthentication no
PermitEmptyPasswords no
...

ssh -v root@localhost
--------------------------------
...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
Enter passphrase for key '/root/.ssh/id_rsa':
debug1: Authentication succeeded (publickey).
Authenticated to localhost ([::1]:xxx).
debug1: channel 0: new [client-session]
debug1: Requesting <email address hidden>
debug1: Entering interactive session.
debug1: client_input_global_request: rtype <email address hidden> want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Welcome to Ubuntu 15.10 (GNU/Linux 4.2.0-19-generic x86_64)
...