Showing results for 
Search instead for 
Did you mean: 


Go to solution


I have an application on my server that need "xhost +" to be executed from the console to run well. How i can make my "xhost +" to start as the system boot?
Honored Contributor

Re: xhost

to generally turn off access control create the file


with the contents


This will allow any host to have acces to the X server.

See also 'man xhost'
Albert E. Whale, CISSP
Honored Contributor

Re: xhost


The simplest place to put this command is in the /etc/inittab file. You can use the following syntax:

xhst:234:once:/usr/bin/X11/xhost +

Have a Great Day!
Sr. Systems Consultant @ ABS Computer Technology, Inc. &
Manuel Plaza
Regular Advisor

Re: xhost

Hi Jasmin,
You can use /etc/X0.hosts. This is an ASCII file that contains the hostnames autorized to use the X display. You must have the name of your server and so is not necesssary to use the "xhost +" command.
Honored Contributor

Re: xhost

Hi Jasmine:

do a man on Xserver. It says in there that you should create a /etc/Xn.hosts where n is the display number (eg. 0) and place in there, the addresses of the hosts to allow... I am guessing if you

# echo "+" >> /etc/X0.hosts

it should do what you want.
nothing wrong with me that a few lines of code cannot fix!
Kenneth Platz
Esteemed Contributor

Re: xhost


Unfortunately Rainer is incorrect. The /etc/X0.hosts file should be a list of hosts that are automatically granted access to the X server. Also, since the X server will attempt to ping every host in this file during initialization, if any host in here is not a valid hostname (including the "+" character) this will instead create a situation where the X server will fail to completely initialise, and you will most likely end up with a black screen.

The easiest way of completely disabling access control on your X server (ie, the equivalent of doing an "xhost +" at the console) would be to add the "-ac" command-line option to the "/usr/bin/X11/X" command-line. If your system uses CDE, then you would want to edit /etc/dt/config/Xservers, and modify it so the "local" entry appears as follows:

* local local@console /usr/bin/X11/X :0 -ac

I hope this helps

I think, therefore I am... I think!

Re: xhost

I tried to put "-ac" option in /etc/dt/config/Xservers file as mentionned. If I do "xhost" command on the console it says access control disable, but it doesn't work until I do "xhost +" again.... Have an idea?