Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The question is based on the thread.

How can you allow only one user to access the display by xhost?

sudo xhost masi is not working in my fresh Ubuntu 9.10.

share|improve this question
what is the output? – John T Dec 20 '09 at 21:44
up vote 2 down vote accepted

I'm testing on Ubuntu 12.04 with X.Org X Server 1.11.3.

I tried Johan's solution and it appeared at first to work, but I found on my system the text after "local:" was being ignored. The result was that all local users were given access to my X session rather than one user.

The magic I found worked was:

xhost +SI:localuser:masi

Replace the portion after the last colon with the username you wish to grant access. You can inspect the authorised list by running xhost with no paramters. It should look something like:

access control enabled, only authorized clients can connect

This indicates that the "masi" user and the "myself" user are being granted xhost permissions in the same way.

share|improve this answer

Basically the same as John T, but you could add inet or local to the command

xhost +inet:masi@
xhost +local:masi@
share|improve this answer
+1 -- Adding the @ sign fixed it for me: xhost +masi@. Not sure why this tidbit isn't in the man page... – redmoskito Nov 21 '10 at 20:04

First, restrict X server access to those who aren't on the list:

sudo xhost -

then add yourself to the allow list:

sudo xhost +masi
share|improve this answer
It gives me xhost: bad hostname "masi" although my admin user is masi. – Masi Dec 21 '09 at 13:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .