0

For some reason, I have to execute xhost +SI:localuser:root to allow GUI for root user. I have put this command in a shell script, which will be executed at startup by upstart. When I execute this command or this script manually as a another user it works fine. But when this script executed by upstart this command doesn't works.

I also tried by executing this command as other than root user in script as

   sudo -H -s otheruser xhost +SI:localuser:root

This also doesn't works.

How can I allow GUI to root user at system startup?

Thanks for your time!

1 Answer 1

2

"GUI for root user" is considered harmful*, but, here's an explanation of your problem:

xhost tells the X Server that it may/may not accept connections from other hosts.

When upstart runs your script, no user has logged in and started an X Server. Therefore, xhost has nobody to talk to.

You need to delay execution of your xhost command until after you've logged in. xhost also needs a definition of the DISPLAY environment variable (so it can find the X Server). man X shows the format of DISPLAY: hostname:displaynumber.screennumber.

Answer: You cannot run xhost through upstart - the context is not right.

    • root is all-powerful, and graphics programs don't show you all that they do.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .