Secure GitHub credentials with KWallet

Konsole + GitHub + KWallet

Hi and welcome to my blog!

KWallet is a KDE Plasma tool to store any credentials and secrets safely. It has an interface called KWallet Manager that allows to manage credentials and secrets easily.

kwallet

In this quick tutorial, I’ll show how to configure your KDE to store your GitHub credentials in KWallet. This guide was tested against openSUSE Tumbleweed but should work for most Linux distributions.

First, make sure to have ksshaskpass installed. ksshaskpass is an ssh-add helper that uses kwallet and kpassworddialog to show a window where you should type your credentials.

Now, create an autostart script file and mark it as executable:

touch ~/.config/plasma-workspace/env/askpass.sh

Open it for edition.

nano ~/.config/plasma-workspace/env/askpass.sh

Put the following content in the file:

1
2
3
#!/bin/sh
export GIT_ASKPASS='/usr/lib/ssh/ksshaskpass'

Save and exit. Now make it executable.

chmod +x ~/.config/plasma-workspace/env/askpass.sh

Next time you log in, open Konsole and try to clone some of your private GitHub repositories. If your wallet is already open and you will see the ksshaskpass dialogue asking for your user name and then asking for your password. Just make sure to mark “Remember password” in both dialogues to save your credentials safely in your wallet.

ksshaskpass

updatedupdated2020-12-252020-12-25
Load Comments?