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

Re: How do you use su under X?



Chip Grandits <chipg@frii.com> writes:
| As has been strongly encouraged, I spend most of my time on my linux box as a
| mortal user.
| Every once in a while I need to go 'root-in' around some system
| files to set up 
| a new application
| that I've downloaded (or for whatever reason?).
| Sure I can type
| $ su root
| at the promt and become root
| but I cannot use the x-server - any attempts result in a message
| 
| Xlib: connection to :0.0 refused by server
| Xlib: Invalid MIT-MAGIC-COOKIE-1 key
| ...
| Also use xhost program...
| 
| Imagine my horror to find I have an invalid magic cookie!  Do I
| really have to 
| use xhost in order
| to use an xwindows session started by another user?

Yes, or you can use the authority file. Personally, what I do in this
situation is:

% su -
Password: ***********
% cp ~user/.Xauthority ~/
% <run X program>

~/.Xauthority is the cookie file. I don't remember if you have to set
the DISPLAY variable? If so I do

% export DISPLAY=:0

Replace "user" above with whatever user you log on as. Of course, if
you have what is essentially a single user system

xhost + localhost

is much simpler.

Gary


Reply to: