KDE Wallet

KDE Wallet Manager is a tool to manage passwords on the KDE Plasma system. By using the KWallet subsystem it not only allows you to keep your own secrets but also to access and manage the passwords of every application that integrates with KWallet.

Note: Since KDE Frameworks 5.97.0 KDE Wallet supports org.freedesktop.secrets DBus API and can now be used by libsecret for storing and retrieving passwords and other secrets using the Secret Service API.

Unlock KDE Wallet automatically on login

To unlock KDE Wallet automatically on login, install kwallet-pam for the PAM compatible module. The chosen KWallet password must be the same as the current user password.

Note:
  • kwallet-pam is not compatible with GnuPG keys, the KDE Wallet must use the standard blowfish encryption.
  • When using autologin, the wallet can only be unlocked if the autologin method saves the password. pam_autologin does, for example.
  • The wallet cannot be unlocked when using a fingerprint reader to login
  • The wallet must be named kdewallet (default name). It does not unlock any other wallet(s).
  • If using KDE, one may want to disable Close when last application stops using it in KDE Wallet settings to prevent the wallet from being closed after each usage (WiFi-passphrase unlock, etc.).
  • It may be needed to remove the default created wallet first, thus removing all stored entries.
  • If the kwallet Migration Assistant asks for a password after every login, rename or delete the ~/.kde4/share/apps/kwallet folder.

Optionally install kwalletmanager for the wallet management tool. This tool can be used to create a KDE Wallet with blowfish encryption and more settings not provided by the kcm-module.

Tip: An alternative is to use KWalletManager and set an empty Kwallet-password, thus preventing the need of entering a password to unlock a wallet. Simply do not enter a password on both fields in Change Password... This may however lead to unwanted (read/write) access to the user's wallet. Enabling Prompt when an application accesses a wallet under Access Control is highly recommended to prevent unwanted access to the wallet.

Configure PAM

The following lines must be present under their corresponding sections:

auth            optional        pam_kwallet5.so
session         optional        pam_kwallet5.so auto_start

Edit the PAM configuration corresponding to your situation:

  • For SDDM no further edits should be needed because the lines are already present in /etc/pam.d/sddm.
  • For GDM edit /etc/pam.d/gdm-password accordingly.
  • For greetd edit /etc/pam.d/greetd accordingly.
  • For LightDM edit /etc/pam.d/lightdm and files:
  • For unlocking on tty login (no display manager), edit accordingly. You will need to specify the force_run parameter.
/etc/pam.d/lightdm-autologin
#%PAM-1.0
auth        required    pam_env.so
auth        required    pam_faillock.so preauth
auth        required    pam_shells.so
auth        required    pam_nologin.so
auth        [success=1 default=ignore]  pam_succeed_if.so user ingroup autologin
auth        required    pam_unix.so
auth        required    pam_permit.so
'''auth        optional    pam_kwallet5.so'''

account     include     system-local-login

password    include     system-local-login

session     include     system-local-login
'''session     optional    pam_kwallet5.so auto_start'''
/etc/pam.d/greetd
#%PAM-1.0

auth       required     pam_securetty.so
auth       requisite    pam_nologin.so
auth       include      system-local-login
'''auth       optional     pam_kwallet5.so'''
account    include      system-local-login
session    include      system-local-login
'''session    optional     pam_kwallet5.so auto_start force_run'''

Using the KDE Wallet to store ssh key passphrases

Install package.

Create an autostart .desktop file:

You also have to set the environment variable to and to (prefer to use the askpass program instead of the TTY). To set it automatically on each login, create the following systemd environment file:

It will ask for your password and unlock your SSH keys. Upon restart your SSH keys should be unlocked once you give your kwallet password.

To add a new key and store the password with kwallet use the following command

$ ssh-add /path/to/new/key </dev/null

and append the key to the list of keys in ~/.config/autostart/ssh-add.desktop as explained above to have it unlocked upon providing the kwallet password.

Using the KDE Wallet to store Git credentials

Git can delegate credential handling to a credential helper. By using as a credential helper, the HTTP/HTTPS and SMTP passwords can be safely stored in the KDE Wallet.

Install the package.

Configure Git by setting the GIT_ASKPASS environment variable:


See for alternatives and more details.

KDE Wallet for Chrome and Chromium

Chrome/Chromium/Opera has built in wallet integration. To enable it, run Chromium with the or argument. To make the change persistent, see Chromium#Making flags persistent. (Setting CHROMIUM_USER_FLAGS will not work.)

Query passwords from the terminal

Instead of storing passwords in plain text files, you can manually add new entries in your wallet and retrieve them with kwallet-query.

For example, if you want to log into the Docker Hub registry with Podman, which supports getting the passwords from stdin with the flag, you can use the following command to login:

$ kwallet-query -r folder_entry wallet_name -f folder_name | podman login docker.io -u dockerhub_username --password-stdin

This way, your password is not stored in any text file and neither is it stored in the terminal history file.

Unlocking KWallet automatically in a window manager

To unlock KWallet protected by the login password, it is necessary to add

exec --no-startup-id /usr/lib/pam_kwallet_init

to the configuration file of the window manager in addition to configuring PAM.

Disable KWallet

In case you want to permanently disable kwallet:

gollark: "Just take bw' from the future"
gollark: It's all so clear.
gollark: And an uncomonad.
gollark: Perhaps we need an unmonad.
gollark: But, see, it's clunkier than just writing operations backwards.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.