Showing results for 
Search instead for 
Did you mean: 

Re: xhost display

Go to solution
Regular Advisor

xhost display


I have an issue with my xhost display for a particular user (findev) on Linux RH AS3 (hostname boxA). For example xclock works fine as root but not for another user account. It only works when I set the display to my local address and this resets whenever I log out again. Can anybody tell me how to make this a permanent fixture?

[findev]$ xclock
Xlib: connection to "" refused by server
Xlib: No protocol specified

Error: Can't open display:
[findev]$ export DISPLAY=:0.0
[findev]$ xclock &
[1] 20235

The user account is used by multiple users therefore hardcoding my local ip address into the .profile is pointless.


Exalted Contributor

Re: xhost display


Take a look at the env data.

You actually want the DISPLAY variable set to the host the user logged in from.

That can be done in the .profile file.

Steven E Protter
Owner of ISN Corporation
Regular Advisor

Re: xhost display


The problem is that the .profile is already configured with the name of the hostname exported as the display but it spits out the error message that I mentioned above.

Regular Advisor

Re: xhost display

Maybe to clarify:

when I execute 'xhost +' I get:

[findev@hostA findev]$ xhost +
Xlib: connection to "" refused by server
Xlib: No protocol specified

xhost: unable to open display ""

whereas it should return:

/home/finprod> xhost +
access control disabled, clients can connect from any host

Honored Contributor

Re: xhost display

You can't run xhost unless you already have access to the DISPLAY. And if you think it's acceptable to use "xhost +" then you don't know enough to be running X anyway.
Respected Contributor

Re: xhost display


If you are trying to display something onto your local display, then as the user you logged into your GNOME Session as, you must execute the xhost + command as that user.

If you login as a non-priv'd user, and then 'su' to the root user, you will not be able to use the xhost command no matter if you are the root user or not.

You can modify, (I'll advise against it for obvious reasons) -or- try creating, a $HOME/.xinitrc file and put your xhost+ command in it, so that it opens up the display when your user account logs in.

Then you can su to the root user account and set your display back and execute your application.

If you are pushing a display across the network to another system, such as another Linux system, then a user *must* be logged in on the linux system graphics console and allow your appliation access by using the xhost + command on it.

If you are pushing a display across the network to a PC running ReflectionX or eXceed or eXcursion, then you will need to use the configuration utility to allow your system to access the PC Display Xserver.

There is plenty of information on this very subject on the web... just a little searching and you will find reams of information on just about every variation of Linux and how to grant X access to that vendors version of X.


I wish you the best of luck in your endeavor.

Rick Retterer
- Rick Retterer

Regular Advisor

Re: xhost display

First and foremost the purpose of this forum is to help and advise not criticise. Comments like ..."then you don't know enough to be running X anyway" are simply rude and arrogant - you should vent your frustrations on some other forum! And secondly the display is running so your pompous remark makes no sense.

Thanks for the feedback. One of the links proved very helpful and helped me resolve the issue. The problem lay with the authorization record (magic cookie).

Regular Advisor

Re: xhost display

Issue resolved by adding the correct magic cookie to the xauth list.