Take the 2-minute tour ×

The following works in cron:

* *  * * *  non-root-user  export DISPLAY=:0.0; zenity --info

And displays a zenity dialog on non-root-user's desktop each minute.

But if I do the following:

* *  * * *  root  export DISPLAY=:0.0; zenity --info

it does not work - nothing is shown on 0.0 display. What am I doing wrong?

share|improve this question
Does not worked for me. 3.5.0-17-generic –  YumYumYum Jan 8 at 4:26
add comment

1 Answer

up vote 2 down vote accepted

You have run afoul of X-windows security! See man Xsecurity, man xauth, and man xhost, but in the short term, you can allow any UID running on your local system to have access to your X display by doing:

xhost +localhost  

as your non-root UID from the session that has the display.

share|improve this answer
It would be resetted after reboot? –  Rogach Feb 7 '12 at 18:36
It would be reset by xhost -localhost or by exiting the X session that owns the $DISPLAY. Fixing things by a reboot is usually not necessary, and often doesn't work. It's not the Linux way. –  waltinator Feb 7 '12 at 20:58
add comment

Your Answer


