Allow only one extra user to access the display

7

2

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.

Léo Léopold Hertz 준영

Posted 2009-12-20T20:25:38.313

Reputation: 4 828

what is the output? – John T – 2009-12-20T21:44:06.067

Answers

9

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
SI:localuser:masi
SI:localuser:myself

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

fuzzyBSc

Posted 2009-12-20T20:25:38.313

Reputation: 216

Note that (at least on Mint 17) the new user (masi in this case) has to have access to the Xauthority file – Joril – 2017-05-23T15:01:12.337

5

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

xhost +inet:masi@
xhost +local:masi@

Johan

Posted 2009-12-20T20:25:38.313

Reputation: 4 827

1+1 -- Adding the @ sign fixed it for me: xhost +masi@. Not sure why this tidbit isn't in the man page... – redmoskito – 2010-11-21T20:04:24.267

1

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

John T

Posted 2009-12-20T20:25:38.313

Reputation: 149 037

1@LéoLéopoldHertz준영 Regardless of that error message it works. To be fair, it worked on one debian machine, but failed on another ubuntu machine. It may be some firewall or extra config. In case that this is not a shared machine you could completely disable xhost control by running xhost +. Any user running on your machine will be able to play X displays. Do not use in shared machines or whatever. – m3nda – 2018-02-25T00:29:15.473

3It gives me xhost: bad hostname "masi" although my admin user is masi. – Léo Léopold Hertz 준영 – 2009-12-21T13:22:46.947