[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Trying to run one process as root, how?



Bryan Walton <walton@berbee.com> writes:
> Greetings to the list,
> 	I have a situation where I need to run one program as root,
> through an x terminal, while my x windows session is being run as
> non-root.  When I open up an x terminal in this environment, become
> superuser, and then execute the program, the program fails with the
> following message:
> 	Xlib: connection to ":0.0" refused by server
> 	Xlib: Client is not authorized to connect to Server
> 	Error: Can't open display: :0.0
> Any ideas?
> Thanks,
> Bryan

Yes, by default XDM/WDM/etc uses magic cookies. Even root doesn't have
authority to override this. My solution is that when I log in as a
user and then su to root and then need to display some X stuff as root
is to run, as root:

export XAUTHORITY=~username/.Xauthority;export DISPLAY=:0

Just replace "username" with the login ID you used when you logged in
and started up X.

Gary


Reply to: