1

I'm currently setting up a borgmatic backup job that should get the repository from the kwallet using the following command:

kwallet-query -r systeembackup kdewallet -f borg

But unfortunately it triggers this error when I run borgmatic:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Couldn't start kwalletd:  QDBusError("org.freedesktop.DBus.Error.Disconnected", "Not connected to D-Bus server")
passcommand supplied in BORG_PASSCOMMAND failed: Command '['kwallet-query', '-r', 'systeembackup', 'kdewallet', '-f', 'borg']' returned non-zero exit status 1.

Because the backup job is run as the root user to be able to perform a full system backup, the command is not able to open the KDE wallet.

I tried running it as my own user:

sudo -i -u ik kwallet-query -r systeembackup kdewallet -f borg

Without success:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-ik'
Couldn't start kwalletd:  QDBusError("org.freedesktop.DBus.Error.Disconnected", "Not connected to D-Bus server")
Wallet kdewallet not found

Also not by setting the XDG variable first:

export XDG_RUNTIME_DIR=/run/user/1000; sudo -i -u ik kwallet-query -r systeembackup kdewallet -f borg

Is there a way to the password from the wallet as a privileged process/user?

2
  • 1
    I think the export is not working for the sudo part. Try sudo -i -u ik export XDG_RUNTIME_DIR=/run/user/1000;kwallet-query -r systeembackup kdewallet -f borg – Michael D. Jan 4 '20 at 23:11
  • @MichaelD That solves it! – EarthMind Jan 5 '20 at 9:54
1

I was able to achieve this by setting

encryption_passcommand: sudo -E -u InsertUserNameHere kwallet-query -r borg-passphrase kdewallet

in /etc/borgmatic/config.yaml.

My borg passphrase was set with:

head -c 32 /dev/urandom | base64 -w 0 | kwalletcli -Pe borg-passphrase -f Passwords

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.