No protocol specified

Ritratto di jdaemon

In Unix-like systems, if it fails to start any graphical application from a terminal which returns an error message contains the following statement:

No protocol specified

with the consequent final warning (that in these cases, must not be considered because there's the first priority statement[0]) of the kind shown below:

WARNING: cannot open display: :x.x

or in rare cases, an Xlib[1] error such as:

Xlib: connection to "<hostname>:x.x" refused by server
Xlib: No protocol specified

it means the user is not authorized to access the server. In other words, a user "Titius" who isn't probably the one running ie "Gaius", is trying to start graphical application.

The problem can be solved by the user running "Gaius" may allow "Titius" to start graphical applications with xhost command and parameters such as:

$ xhost +si:localuser:Titius[2]

or even with least restrictive policies such as:

° to allow access to all users logged in locally with the statement
$ xhost +localhost

° disabling the access control so that all users can connect to (from any host) with the statement
$ xhost +

To make it permanent that is working even after the computer boot, root user must include these kinds of xhost statements in files of /etc/X11/Xsession.d/ system directory. The exact file name should be as XX-common_localhost or XX-common_xhost-local.

[*] The user can always view the access control to the server with the command xhost (without parameters)
[0] When the "No protocol specified" statement does not appear the problem moves to the name display
[1] Xlib is an protocol client library that contains functions for interacting with the X server
[2] Further information about the xhost parameters look related man page