2

I have a few scripts that need to be started as root and from cron, and need basic user interaction with zenity. To start zenity on user screen, I was used to this form of command:

DIPLAY=:0 sudo -u some_user zenity ...

But if the user is running a Wayland session:

  • who now shows /dev/tty2 instead of :0
  • the above command does not work (regardless :0 or /dev/tty2 as DISPLAY value), and returns Error: Can't open display: /dev/tty2

Do you know the "Wayland way" to achieve a similar goal? (Although I am less interested, a MIR equivalent would be an interesting bonus...)

Again, to be clearer, my question is about Wayland user session: I have no problem when user session is running under Xorg. If you still think my question is a duplicate of this one, please explain why.

Yvan
  • 21
  • 1
    sudo may very well clear your environment. – Kusalananda Feb 13 '17 at 14:37
  • 2
    @roaima This question does not speak about Wayland. – Yvan Feb 13 '17 at 15:42
  • True, but it does explain how to handle zenity under cron. FWIW after your clarification I've now voted to reopen so we'll see what happens. – Chris Davies Feb 13 '17 at 20:05
  • @don_crissti Thanks for the interesting link. But if I understand well this bug report, it is about "from user Wayland session, run GUI as root", which is different from "from root cron/TTY session, run GUI as current Wayland user". The program would run as the same user as the Wayland session: it is not stated that is is not possible. – Yvan Feb 14 '17 at 16:09
  • It seems I was wrong in my tests, because even if who reports /dev/tty2 instead of the usual :0, the command works from TTY using :0 (which is indeed the DISPLAY value you can get from inside the Wayland session): DISPLAY=:0 sudo -u user some_command. This question is solved, sorry for the noise. – Yvan Feb 14 '17 at 16:50
  • Oh, ok I misunderstood the q then... no problem – don_crissti Feb 14 '17 at 17:38

0 Answers0