Keychain

From HalfgeekKB
Jump to navigation Jump to search

Template:Lowercase

keychain is a program that facilitates reuse of ssh-agent and gpg-agent from login to login. The upshot is that you don't have to enter passphrases with frustrating frequency.

Inserting into login scripts

The man page says this typically goes in .bash_profile (with a new enough version...so upgrade if this doesn't work):

eval `keychain --eval id_rsa id_dsa 0123ABCD`

Replace the key names with any SSH and GPG keys you want it to use sans intervention.

Replacing GNOME Keyring

According to this wonderful article, the nuisance that is GNOME Keyring can be replaced with keychain by overriding the former's autostart entries with ones in your home dir.

Do this, then log out and back in.

mkdir -p ~/.config/autostart

cat << EOF > ~/.config/autostart/gnome-keyring-ssh.desktop
[Desktop Entry]
Type=Application
Name=SSH Key Agent (keychain)
Exec=keychain --quiet --agents ssh
EOF

cat << EOF > ~/.config/autostart/gnome-keyring-gpg.desktop
[Desktop Entry]
Type=Application
Name=GPG Key Agent (keychain)
Exec=keychain --quiet --agents gpg
EOF