Link to home
Start Free TrialLog in
Avatar of rj2
rj2

asked on

Xlib: connection to ":0.0" refused by server

Hello!
Sometimes when starting e.g. nedit from terminal window in Gnome in Redhat 7.3 I get error message as shown below. The problem only occurs when trying to start programs from terminal window, if I select nedit from Gnome menu instead it starts alright.
It's the same for all X programs, it's not only nedit.

Why is this happening, and how do I fix it?
Kernel is 2.4.20-19.7

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
Nedit: Can't open display
ASKER CERTIFIED SOLUTION
Avatar of nasa
nasa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rj2
rj2

ASKER

X is running as myself (rj2)
Actually I was using my own user when problem occured, but I had changed to root and back again previously with su. Looks like problem only occurs when I does that. No problem when root, only after changing back to myself again.
"xhost +" fixed it.
Are there security issues with running "xhost +" ?
xhost + actually will allow any networked computer open up a display on your computer.  I have seen this problem but not enough times to know how to fix it.

When you change back to yourself do you "exit" or do you "su"

When I saw this, I put a laptop in hibernation mode and when it restarted I didn't have X permissions.

With xhost, if you want to limit the people connecting to your display do "xhost + mymachinename"  That will only allow those logged into your display to open programs.  Again it is not strictly safe because if someone else can get on your machine they can open up programs on your display.

Good Luck
Avatar of rj2

ASKER

I changed back with "su username", not exit
doing that will create a loop, you should use exit after you su into root.
Hey rj2,

What Willy134 said is correct -- make sure you 'exit' when going back to your user.  Given that you were using 'su' alot, you may not need xhost at all.  However, a personnal favorite of mine is to add "xhost +root" to my .bashrc file (or whatever your shell configuration file is) so that I can run graphical apps as root (such as mcc under mandrake).  This may be breaking some kind of security rule -- but a hacker would have to be able to log into your system as root, which means you have a bigger security problem than xhost.  


Thanks for the points


nasa
"xhost + actually will allow any networked computer open up a display on your computer."

this is only true sometimes, in the startup of X (startx, xservers.rc etc) there can be a command line option to X (the X server) --nolisten tcp, that stops X listening on TCP so you can't connect from othermachines via TCP/IP (which is what I wanted to do, and took me ages to find)

I think that was in man X

I have a same problem but after I logon on to another machine, have no idea why exactly this machine is giving the problem.
logging onto other machines the same way does not result in revoking permotions to start an app locally

I also can not run xhost +
it affects in
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Thank you for your help
I've got the same problem.  Neither the command I want to run (synaptic, so I can see why it's crashing on me) or xhost will work from su where I need them to.
I had this problem. The reason behind it was due to several different session in the same window. i.e. I'd logged on as root then oracle, then root etc without exiting first. I assume xhost could see this.
hi
now,open a console:alt+f2
turn root:su root
xhost localhost ip address:0 0

try
I dont understand. isn't
 xhost +
suppose to allow everything to everybody from everywhere on the X server ...

besides what do you mean by localhost ip address (and/or)?

regards