The whole point of setting the DISPLAY and XAUTHORITY variables to make it so you CAN open the window as root. Trying to use the .Xauthority for the root user won't work unless the X server was started by root. So you specify the .Xauthority for jjj, and as long as X is actually running then it works fine. Of course if something closes X in the middle of the night then yeah it's going to fail.
You can try this on literally any distro, no guesswork is required. start your desktop, then hop out to a different VT (ctrl+calt+f2), log in, sudo su to root and then execute the following: DISPLAY=:0 XAUTHORITY=/home/<username>/.Xauthority xterm If this fails then X is either not running as the chosen user, not running at all, or has been configured using non-standard settings. Another possibility is that cron is not actually running commands as root. Am I wrong to assume that cronjobs are always run as root? I don't actually know since I don't mess with cron beyond the most basic options. Most of my cron tasks were made by point-and-click in FreeNAS. On Tue, Jan 28, 2020 at 3:57 PM Tomas Kuchta <[email protected]> wrote: > The topic to research would be X11 authorization and MIT cookies. > > It will require commands to run on both sides of the command line: a) your > desktop will need to authorize the connection (every time you start > desktop) b) Cron using that authorization to display the window. > > The easiest to work around is probably for Cron to write a message to a > file and some forever running desktop script checking that file and open > the dialog. > > Another alternative would be to use system messaging infrastructure in > Gnome/KDE. > > One could also send a message to all user's consoles by ancient command > wall. > > Hope that helps, > Tomas > > > > On Tue, Jan 28, 2020, 16:58 wes <[email protected]> wrote: > > > On Tue, Jan 28, 2020 at 1:21 PM Johnathan Mantey <[email protected]> > > wrote: > > > > > I'm only paying half attention to this. > > > You want to run as root, but you are using your own Xauth? > > > I'm no X11 wizard, but that doesn't seem like it would work. > > > Doesn't /root have a Xauthority file that should be used for root run > > > features? > > > > > > > > This only exists if the root user were to have logged in to X at some > > point. This is disabled by default. > > > > Additionally, the goal here is to pop a dialog on the jjj user's X > desktop > > from a command run by root. > > > > -wes > > _______________________________________________ > > PLUG mailing list > > [email protected] > > http://lists.pdxlinux.org/mailman/listinfo/plug > > > _______________________________________________ > PLUG mailing list > [email protected] > http://lists.pdxlinux.org/mailman/listinfo/plug > _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
