Configure Xauthority

July 4, 2018

Environments that use interactive remoting using X11 display functionality (including xterm and gvim) are supported by the Linux VDA. This feature provides a security mechanism necessary to ensure secure communication between XClient and XServer.

There are two methods to secure permission for this secure communication:

Xhost. By default, Xhost allows only the localhost XClient to communicate with XServer. If you choose to allow a remote XClient to access XServer, the Xhost command must be executed to grant permission on the specific machine. Or, you can alternately use xhost + to allow any XClient to connect to XServer.

Xauthority. The .Xauthority file can be found in each user’s home directory. It is used to store credentials in cookies used by xauth for authentication of XServer. When an XServer instance (Xorg) is started, the cookie is used to authenticate connections to that specific display.

How it works

When Xorg starts up, a .Xauthority file is passed to the Xorg. This .Xauthority file contains the following elements:

After enabling Xauthority, pass the .Xauthority file to XClient manually or by mounting a shared home directory:

Pass the .Xauthority file to XClient manually

After launching an ICA session, the Linux VDA generates the .Xauthority file for the XClient and stores the file in the logon user’s home directory. You can copy this .Xauthority file to the remote XClient machine, and set the DISPLAY and XAUTHORITY environment variables. DISPLAY is the display number stored in the .Xauthority file and XAUTHORITY is the file path of Xauthority. For an example, see the following command:

If the XAUTHORITY environment variable is not set, the ~/.Xauthority file is used by default.

Pass the .Xauthority file to XClient by mounting a shared home directory

The convenient way is to mount a shared home directory for the logon user. When the Linux VDA starts an ICA session, the .Xauthority file is created under the logon user’s home directory. If this home directory is shared with XClient, the user does not need to transmit this .Xauthority file to XClient manually. After the DISPLAY and XAUTHORITY environment variables are set correctly, the GUI is displayed in XServer desktop automatically.

Troubleshooting

If Xauthority does not work, follow the troubleshooting steps:

As an administrator with root privilege, retrieve all of Xorg cookies:

ps aux | grep -i xorg

This command displays the Xorg process and the parameters passed to Xorg while starting. Another parameter displays which .Xauthority file is used. For example:

/var/xdl/xauth/.Xauthority110

Display the cookies using the Xauth command:

Xauth -f /var/xdl/xauth/.Xauthority110

Use the Xauth command to show the cookies contained in ~/.Xauthority. For the same display number, the displayed cookies must be the same in the .Xauthority files of Xorg and XClient.

If the cookies are the same, check the remote display port accessibility by using the IP address of the Linux VDA (for example, 10.158.11.11) and the published desktop display number (for example, 160).

Run the following command on the XClient machine:

telnet 10.158.11.11 6160

The port number is the sum of 6000 + <display number>.

If this telnet operation fails, the firewall might be blocking the request.