While the instructions here are broadly correct, I had to make some changes to make it work.
Step 1, "Unlock KDE Wallet automatically on login", is already done for Kubuntu 22.10. For me, step 2, "Using the KDE Wallet to store ssh key passphrases", needed modification and step 3, "Using the KDE Wallet to store Git credentials" was not needed (Git with ssh works fine without it):
I made a file ~/.local/bin/delayed_ssh_add
I put the following lines in that file:
#!/bin/bash
sleep 15
/usr/bin/ssh-add -k ~/.ssh/YOUR_SSH_KEY
You can add as many ssh keys as you like using /usr/bin/ssh-add -k ...
. Note that I found that I had to use the full path to the ssh key starting from /home
rather than using ~
for my home directory.
I made the file executable
I made a file ~/.config/autostart/delayed-ssh-add.desktop
I put in it:
[Desktop Entry]
Comment[en_NZ]=
Comment=
Exec=/home/YOUR_HOME_FOLDER/.local/bin/delayed_ssh_add
GenericName[en_NZ]=
GenericName=
MimeType=
Name[en_NZ]=delayed-ssh-add
Name=delayed-ssh-add
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=
I made a file ~/.config/environment.d/ssh_askpass.conf
I put in it:
SSH_ASKPASS='/usr/bin/ksshaskpass'
SSH_ASKPASS_REQUIRE=prefer
To explain the above, the change I made was to add the ssh keys after a delay of 15 seconds rather than immediately. I speculate that this is because KWallet or a related service starts after autostart applications begin executing as I also had to delay launching Skype (for which I can also see credentials in KWalletManager).
In case of interest to Python coders: to get GitHub requirements in requirements.txt in a Python project working without prompting for a password, I had to use the following form rather than https:
git+ssh://git@github.com/anntzer/defopt@main#egg=defopt
ssh-add -l
shows empty). I fixed by adding ssh-add in the ~/.zshrc. But found it not elegant b/c the ssh-add is re-run in every tab opened in kconsole. The solution suggested by @mcarans works exactly as described by the author. Thesleep 15
happens in the background and doesn't slow down KDE Plasma startup. – Polymerase Aug 27 '23 at 06:12