I'm working on a bash script which requires root privileges, but which I'd like to give the ability to notify a non-root user of certain alerts via notify-send
in GNOME (or any other desktop shell supporting that command). As expected, simply invoking notify-send
from a root shell doesn't display a notification on the non-root user's desktop.
I've tried to invoke the command via:
su -c "notify-send 'my message'" -s /bin/sh someuser
(as well as using /bin/bash
, /usr/zsh
), but neither of these has had any effect.
How can I invoke notify-send
from a root shell so that it shows a notification on a (specified) non-root user's desktop?
notify-send
0.7.7 running on Arch Linux (kernel 4.8.6). Can you confirm whether, in past cases, it's worked with applications which affect a GUI desktop environment? – Jules Nov 13 '16 at 09:13