xhost and how to use it

XHOST OVERVIEW


xhost is a program that controls access for X server. You can use xhost to limit access for X server for security reasons. The following message is what you get when connection is rejected by xhost:

Xlib: connection to "192.168.1.251:0.0" refused by server
Xlib: No protocol specified

Error: Can't open display: 192.168.1.251:0


Block all access (xhost -) and only allow local applications, you would use:

-bash-3.2$ xhost -

access control enabled, only authorized clients can connect


To allow all host, you would use:

-bash-3.2$ xhost +

access control disabled, clients can connect from any host


To block or allow specific host, you would use:

$ xhost + 192.168.1.101

This command allows access from the host, 192.168.1.101.


$ xhost - 192.168.1.101

This command blocks access from the host, 192.168.1.101.


USING ACCESS CONTROL IN XMANAGER


Xmanager is an X Server and has xhost feature built-in. By default, Xmanager allows connection from any hosts. To enable xhost access control:


  1. Open Xconfig and double click on Default Profile (or select an appropriate Xconfig profile, if you are using a different profile for your Xmanager session)



  2. Click on the Security tab
  3. Select the Enable Access Control option
  4. Enter the IP address or the host name in the Trusted Hosts list
  5. Click OK