2

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 '17 at 20:58
  • 2
    Also look into xauth, MIT magic cookies and ssh X forwarding.
    – dirkt
    Apr 13 '17 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 '18 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 '18 at 16:16
  • xhost +local:root Dec 11 '19 at 12:30
1

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

2
  • 1
    These allow all local users to access the display. Oct 29 '17 at 15:51
  • 1
    indeed , that includes root which is probably not advisable unless there is a specific need.
    – stacker
    Feb 6 '18 at 16:20

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.