Installed OpenBSD with all the sets and using the default FVWM2.

I log in to FVWM2, open xterm:

$ echo $DISPLAY

And "su -" to root and create a normal user:

useradd -m TESTUSER

ok! Now I:

$ export DISPLAY=":0" 
$ xcalc               
No protocol specified
Error: Can't open display: :0

If I try (with the normal user with I logged in to FVWM2):

$ xhost +

Then it works (the "TESTUSER" can launch xcalc)! But I don't want to allow any to connect to my X server. Only a given local user. But I cannot add the local user:

$ xhost +local:TESTUSER    
non-network local connections being added to access control list
$ xhost              
access control enabled, only authorized clients can connect

With the "LOCAL:" I think I enable all the local users, which is BAD.

Q: How to only enable the given local useR?

  • does export DISPLAY=:0.0 change anything? Dec 10 '17 at 20:15
  • updated question, found something
    – Hessnov
    Dec 10 '17 at 20:28
  • Have a look at xauth and .Xauthority. Users must be authenticated (MIT magic cookie) before being able to use the X server. Much safer than xhost.
    – dirkt
    Dec 11 '17 at 7:58
  • wow, thanks, but why is it safer?
    – Hessnov
    Dec 11 '17 at 22:34
$ xhost +si:localuser:TESTUSER

worked with the user that started the X (FVWM2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.