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}" ]
then
export GIT_ASKPASS=${SSH_ASKPASS}
export SSH_ASKPASS
fi
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/null
this 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.
I have Fedora KDE and it’s enough to overwrite SSH_ASKPASS
.
By default I have:
$ echo $SSH_ASKPASS
/usr/libexec/openssh/gnome-ssh-askpass
So it was enough to set in .zshrc
or .bash_profile
:
export SSH_ASKPASS=/usr/bin/ksshaskpass
As stated here, GIT_ASKPASS will fallback to SSH_ASKPASS.
.zprofile not .zshrc
Or .zshenv
?
It looks to me you are right, .zprofile
is the best answer.