keepassxc autounlock with kdewallet

keepassxc autounlock with kdewallet


  1. the user password in the system must be the same as the password from the kwallet database to automatically unlock the database upon login.
  2. create folder for keebass db passwords and record with password for db by hand in kwalletmanager5

#!/usr/bin/env bash

USERNAME="$(whoami)"
HOMEPATH="$(echo /home/$USERNAME)"
# $KDBXPATH, $FOLDERNAME, $RECORDNAME and $WALLETNAME you must specify manually
# here i put my details
FOLDERNAME=keepassxc
RECORDNAME=pass.kdbx
WALLETNAME=kdewallet
KDBXPATH="$HOMEPATH/path/for/your/keepass.kdbx"
KWALLETQUERYPATH=$(which kwallet-query)
KEEPASSXCPATH=$(which keepassxc)

echo "#!/usr/bin/env bash
$KWALLETQUERYPATH -f $FOLDERNAME -r $RECORDNAME $WALLETNAME | $KEEPASSXCPATH --pw-stdin $KDBXPATH
"
> "$HOMEPATH/.local/bin/keepass_autostart.sh"

chmod +x "$HOMEPATH/.local/bin/keepass_autostart.sh"

echo "[Desktop Entry]
Exec=$HOMEPATH/.local/bin/keepass_autostart.sh
Icon=dialog-scripts
Name=keepass_autostart.sh
Path=
Type=Application
X-KDE-AutostartScript=true
"
> "$HOMEPATH/.config/autostart/keepass_autostart.sh.desktop"

echo 'auth optional pam_kwallet5.so
session optional pam_kwallet5.so

' | sudo tee -a /etc/pam.d/sddm

Содержание