X11 - Xhost

> SSH (Secure Shell) - Remote Access > X Windows System (commonly X or X11)

1 - About

xhost is an X client software which is a part of the X11 security. It manage the list of the remote server that can make a connection with the local x server

You use it in a xterm terminal before you made a ssh connection with the remote server.

The xhost program is used to add and delete host names or user names to the list allowed to make connections to the X server.

In the case of hosts, this provides a rudimentary form of privacy control and security. It is only sufficient for a workstation (single user not multi user) environment, although it does limit the worst abuses. Environments which require more sophisticated measures should implement the user‐based mechanism or use the hooks in the protocol for passing other authentication data to the server.

Advertising

3 - Syntax

$ xhost [[+−] fully_qualified_remote_host_name ...] 

4 - Example

$ xhost remoteserver.gerardnico.com
remoteserver.gerardnico.com being added to access control list

The local X server will then now authorize to receive a X flow from the remote server (remoteserver.gerardnico.com).

5 - How to get the authorized clients to connect ?

$ xhost
access control enabled, only authorized clients can connect
INET:oel5u5.gerardnico.local.cornac.net
INET:10.35.17.202
INET:10.3.50.19
INET:gerardnico.cornac.net
INET:192.168.205.1
INET:192.168.8.1
INET:localhost
LOCAL:

6 - Support

6.1 - Connection to "192.168.2.2:0.0" refused by server

If you forget to add the remote server to your authorized list, you will then receive this error:

[root@oel5u5 ~]# xclock&
Xlib: connection to "192.168.2.2:0.0" refused by server
Xlib: No protocol specified
 
Error: Can''t open display: 192.168.2.2:0.0