Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.