Keyring no longer prompts for password when SSH-ing
- by Lie Ryan
I remember that I used to be able to do ssh [email protected] and have a prompt asks me for a password to unlock the keyring for the whole GNOME session so subsequent ssh wouldn't need to enter the keyring password any longer (not quite sure if this is in Ubuntu or other distro).
But nowadays doing ssh [email protected] would ask me, in the terminal, my keyring password every single time; which defeats the purpose of using SSH keys.
I checked
$ cat /etc/pam.d/lightdm | grep keyring
auth optional pam_gnome_keyring.so
session optional pam_gnome_keyring.so auto_start
which looks fine, and
$ pgrep keyring
1784 gnome-keyring-d
so the keyring daemon is alive.
I finally found that SSH_AUTH_SOCK variable (and GNOME_KEYRING_CONTROL and GPG_AGENT_INFO and GNOME_KEYRING_PID) are not being set properly. What is the proper way to set this variable and why aren't they being set in my environment (i.e. shouldn't they be set in default install)?
I guess I can set it in .bashrc, but then the variables would only be defined in bash session, while that is fine for ssh, I believe the other environment variables are necessary for GUI apps to use keyring.