Xlib: connection refused

I boot may X as a user.
When I need root permition I su  to root.
for some resone I cant run any X application as root (DISPLAY env is fine :0 )
The message I get is:

Xlib: connection to ":0.0" refused by server
Xlib: Client is not authorized to connect to Server

Only if as a user i do xhost + (to disable authentications) can i run X based programs as root

Where should I lok for an answer ?
P.S (almost all may packages are updates of RH 6.1 or mandrake)
finkelgAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ahoffmannCommented:
you gave the answer yourself: xhost +

check X and/or xhost man-pages for details, you also may use X's -auth option, but it's more complicated to setup
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
finkelgAuthor Commented:
When using xhost + evry one from that host can run x clients on my server.

The better answer I found was that I have an .Xauthorty file in my home dir which uses a MAGIC-KEY ... with a code for each display I want to protect (Usally :0 ).
If I whant others(root too) to connect to that display they too need the .Xauthorty file with    that code so here what you do:

Run xauth list, copy the code, su to the user you what to give excess, xauth add . <the code you copy> ,

Now that user can X client to my X server but others cant
See also Xauth menuals
0
ahoffmannCommented:
so, what's the question now?
0
finkelgAuthor Commented:
None just wanted you to know
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.