A user (
user1) on an Ubuntu 12.04 desktop has two SSH RSA keys configured:
.pub files). Both public keys are configured in the authorised keys on the server's account (
When logged on to the desktop (client) machine, and using a Gnome Terminal, logging on to the server using either keys works fine:
ssh user1@myserverimplicitly picks up
ssh -f /home/user1/.ssh/id_rsa1 user1@myserveralso works.
If, instead of logging on via the Gnome Desktop, I log on to the client machine via SSH from another host (or even
localhost) or use
/home/user1/.ssh/id_rsa no longer works.
This appears to have something to do with
SSH_AUTH_SOCK (missing originally in the environment set up with an SSH connection to the client). If I set it up to be the value visible in the desktop session
/tmp/keyring-xxxxxxxxxxx/ssh, logging in with
id_rsa works fine again.
If I unset
SSH_AUTH_SOCK (to make logging with
id_rsa fail again), and copy
.pub files), it now works with
What can explain the difference of behaviour between those two key pairs and their interaction with
I can't see anything in the server logs.
Here is the fragment of the SSH client logs, just before it differs:
debug1: ssh_rsa_verify: signature correct debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /home/user1/.ssh/id_rsa (0x7f6b7059b260) debug1: Authentications that can continue: publickey,password debug3: start over, passed a different list publickey,password debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/user1/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply
Followed by this, when it doesn't work for that user/key:
debug1: Authentications that can continue: publickey,password debug2: we did not send a packet, disable method