LinuxCommandLibrary

xhost

TLDR

Display the current access control list

$ xhost
copy
Allow a specific host to connect
$ xhost +[hostname]
copy
Deny a specific host from connecting
$ xhost -[hostname]
copy
Allow all hosts to connect (disable access control - insecure)
$ xhost +
copy
Deny all hosts except those explicitly allowed
$ xhost -
copy
Remove a specific user or address using family prefix
$ xhost -[family:name]
copy

SYNOPSIS

xhost [[+|-]name...]

DESCRIPTION

xhost manages the X server access control list. It controls which hosts and users can connect to the X display server.
Family prefixes include: inet (IPv4), inet6 (IPv6), si (server interpreted), localuser (local user), and local (local connections).

PARAMETERS

+_hostname_

Add host to access list
-_hostname_
Remove host from access list
+
Disable access control (allow all)
-
Enable access control (restrict to list)
+si:localuser:_user_
Allow local user
-si:localuser:_user_
Deny local user
+inet:_hostname_
Allow by IP family

CAVEATS

Using xhost + is a security risk as it allows any host to connect. For secure remote X access, use SSH X forwarding instead. Access changes are not persistent across X server restarts.

HISTORY

xhost is one of the original X Window System utilities, providing basic access control since the early days of X11.

SEE ALSO

xauth(1), X(7), ssh(1)

Copied to clipboard