A application running as root, what is the best way for it to send notifications to the normal logged in user?

Β· Web Β· 3 Β· 2 Β· 1

@kushal so I understood it probably wrong. Good luck anyway πŸ‘

@abhas my code is running as root and i can not figure out how to talk to session dbus from there to show the notification

@kushal You could `su` to a normal user for using dbus to send notifications. There is an example here:

sudo -u X_user DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/X_userid/bus notify-send 'Hello world!' 'This is an example notification.'

@abhas yes this exactly what I am using now , but I was hopping to do from code properly :)

@kushal How about running your desktop application as root inside a docker container using x11docker and then using this method to connect dbus to your application:


:) ... as compared to running a GUI (or any) application as root?

You are still free to complicate the application further by "securing" it using apparmor

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!