5

I have basic desktop machine with two user accounts. I want to allow the second user ( no the one which started X ) to access xserver and run GUI programs.

I had this working using xhost from the login user but this no longer seems to work.

xhost +SI:localuser:fred

now if I do su - fred and try anything which requires X, I get an error to the effect that it cannot access the display.

$ xhost
xhost:  unable to open display ""

Please do not reply about how to use vnc, ssh or remote access. That is not the question.

Thanks for any help in how to do this, it is stopping me being able to work.

5
  • 4
    Have you tried setting the DISPLAY variable? eg DISPLAY=:0 xterm
    – Stefan
    Apr 12, 2017 at 20:58
  • 2
    Also look into xauth, MIT magic cookies and ssh X forwarding.
    – dirkt
    Apr 13, 2017 at 7:35
  • dirk, you seem to have missed : "Please do not reply about how to use vnc, ssh or remote access. That is not the question. "
    – stacker
    Feb 6, 2018 at 16:13
  • thanks Stephan, DISPLAY does the trick also. xhost seems to be the definitive answer, not sure who gave that -1 This all seems rather hit and miss. That's what I don't get. Sometimes I login to a new session or open a new shell ; sometimes it works other times not. :?
    – stacker
    Feb 6, 2018 at 16:16
  • xhost +local:root Dec 11, 2019 at 12:30

1 Answer 1

5

you can try this:xhost local: or this: xhost +127.0.0.1. I prefer the first solution. Cesare

4
  • 1
    These allow all local users to access the display. Oct 29, 2017 at 15:51
  • 1
    indeed , that includes root which is probably not advisable unless there is a specific need.
    – stacker
    Feb 6, 2018 at 16:20
  • xhost local: works, thanks! Apr 19, 2022 at 1:03
  • FYI: The inverse command is xhost -local: to remove non-network local connections from the access control list again.
    – miguno
    Jan 30 at 19:56

You must log in to answer this question.

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