Set SSH Keyring on Arch Linux

22 December 2015

If you use SSH keys and you have to enter the password every time to unlock them, you surely have already tried to set up a keyring. However, it is not always very clear how to do it as they are several ways of doing it.

Yes, you see it well, it didn't asked for my password!

I recommend you to follow the part telling how to "Start ssh-agent with systemd user" in the Arch Linux wiki (I copied it below): https://wiki.archlinux.org/index.php/SSH_keys#SSH_agents

Arch Wiki:

It is possible to use the systemd/User facilities to start the agent.

~/.config/systemd/user/ssh-agent.service

[Unit]

Description=SSH key agent

[Service]

Type=forking

Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket

ExecStart=/usr/bin/ssh-agent -a $SSH_AUTH_SOCK

[Install]

WantedBy=_default_.target

_Add export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" to your shell's startup file, for example .bash_profile for Bash. Then enable or start the service._

If it is still not sufficient as it happened to me, replace the _export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"_ in the shell's startup file the Wiki talked about by the output of gnome-keyring-daemon -s.(it implies that you have installed gnome-keyring before)

In my case, it looks like this:

export SSH_AUTH_SOCK=/run/user/1000/keyring/ssh

And finally, if after a reboot it still doesn't work, try by adding the path to your SSH keys in ~/.ssh/config:

IdentityFile ~/.ssh/gitHubKey
IdentityFile ~/.ssh/id_rsa_buhlServer

(Thanks to daminetreg's comment on StackOverflow)

I hope it will help you! Please let me know if it solved your issue or not.