dyne / tomb

the Crypto Undertaker
https://dyne.org/software/tomb
GNU General Public License v3.0
1.32k stars 150 forks source link

DBUS_SESSION_BUS_ADDRESS not set when running tomb via .desktop launcher #429

Open AimoE opened 2 years ago

AimoE commented 2 years ago

I am using tomb in Ubuntu 20.04 (which has Gnome desktop). I have a script which runs fine on bash command line. I also run the same script via a .desktop launcher, which has "Terminal=True" set, because I want to see all the messages that the script emits.

When the script runs all tomb commands with sudo, I get "No $DBUS_SESSION_BUS_ADDRESS found, falling back to curses" for any the tomb commands that refer to a key, and I have to type the passwords for the keys in the terminal window in a clumsy manner.

However, when the script runs all tomb commands without sudo, I get a neat separate pop-up window whenever a password is needed for a tomb key. For the first tomb command, I also get a prompt for sudo password in the terminal window (because my sudoers setting does not apply).

Is this a bug or a feature, and is there something I could do to get DBUS_SESSION_BUS_ADDRESS set for the tomb commands in this setup?

Narrat commented 2 years ago

The env var is tied to a specific user. For example: DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus So as you invoke tomb with sudo this env isn't available. The reason for this? Depends on your setup and settings? It could be running with a different user, sudo not inheriting env vars. Sadly I'm currently not really sure, but it is more due to a feature and not of a bug in tomb. At least this is my assumption. There were recently changes in regards of privilege escalation. Maybe there got something included which helps in this case