GNOME or to be more precise GNOME keyring has nice feature of including ssh-agent that integrates nicely with gnome-keyring. I find this feature very convenient since I don’t have to input my password every time I connect to a server. (I sincerely hope that no one is using ssh-keys without password protection).
Things are quite not as convenient on KDE side of desktop environments even though KDE provides handy tool called KDE wallet. Luckily with few simple scripts we can use the combination of KDE wallet and ssh-agent to provide similar functionality on KDE. So without further ado here is the guide.
Open your favorite text editor and create file ~/.kde/env/ssh-agent.sh. Add following lines into file and save it.
#!/bin/bash eval `ssh-agent`
Create file ~/.kde/Autostart/ssh-add.sh and add following lines.
#!/bin/bash export SSH_ASKPASS=/usr/bin/ksshaskpass /usr/bin/ssh-add
Create file ~/.kde/shutdown/ssh-agent.sh and add following lines.
#!/bin/bash eval `ssh-agent -k`
As a last step you need to give execute rights for the scripts that we just created.
chmod +x ~/.kde/env/ssh-agent.sh chmod +x ~/.kde/Autostart/ssh-add.sh chmod +x ~/.kde/shutdown/ssh-agent.sh
That’s it! Now simply log out and log back in and notice how kde-wallet will prompt for password and also your ssh-key password will be asked. In case you want check the “remember this password” option and your ssh-key password will be remembered by kde-wallet. One could argue that this type of functionality should be on default KDE installation but then again it wasn’t too hard to achieve this way either.