Set SSH Keyring on Arch Linux

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.

Keywords: Arch Linux, Linux, Open source, Bash

A comment?

You found an error in this article? Some advice? You can send a comment by email to "blog at killiankemps.fr" with "[Comment][en][Set SSH Keyring on Arch Linux]" as subject.
(The "@" has been replaced by "at" to avoid bad bots to parse the email address)

Send a comment by email