Auto add keys to ssh agent at login

How to start the ssh-agent and add a key automatically at login? I tried the steps on Arch docs, but didn’t work.
Does KDE really not have a GNOME Keyring alternative in terms of ease of use?

KDE starts ssh-agent automatically, nothing for you to do.
KDE has the kwallet service that you use to store passwords and passphrases in.

You will need to setup the following to have your ssh keys loaded into the agent.
I add the following to my .bash_profile:

# need to setup ask pass even if not using a terminal
# as is the case when KDE is logging in
if [ -e "${SSH_ASKPASS:=/usr/bin/ksshaskpass}" ]
    export SSH_ASKPASS

I then add a script as a startup item in KDE settings to do the adding of ssh keys.
I have lines like this in my script:

# always have the SSH keys loaded
ssh-add ~/.ssh/id_ed25519 </dev/null

Note the </dev/nullthis forcing a GUI prompt from ksshaskpass.

Once that is setup you can run the script once to add the passphrases.
Then when you login ksshaskpass with automatically get the save passphrase out of the KDE wallet.

You can inspect the wallet from the system settings.

1 Like