2

I am trying to run a program after enabling X windows port forwarding.

My sshd_config file in /etc/ssh/sshd_config is configured such that:

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

and my ssh_config file in /etc/ssh/ssh_config has:

Host *
ForwardAgent yes
ForwardX11 yes

I try to enable X Windows port forwarding with

lemon:~ # ssh -X localhost
lemon:~ # echo $DISPLAY

lemon:~ # /usr/bin/SMclient
xdpyinfo:  unable to open display "".
Unable to launch GUI due to X server display setting problem, Exiting .

So $DISPLAY is set to nothing. I have tried everything I've seen online. Originally there was no .Xauthority file so I copied from /var/run/gdm/auth-for--/database and renamed the file .Xauthority

I then tried

lemon:~ # xauth generate :0 . trusted
Invalid MIT-MAGIC-COOKIE-1 keyxauth: (argv):1:  unable to open display ":0".

When this didn't work, I deleted the old .Xauthority file and then:

lemon:~ # touch ~/.Xauthority
lemon:~ # xauth generate :0 . trusted
No protocol specified
xauth: (argv):1:  unable to open display ":0".  

And many others suggested to run host + which just leads to

lemon:~ # xhost +
xhost:  unable to open display ""
  • Fiddling with .Xauthority and xhost is pointless because that's not where you have a problem (but be careful, your fiddling may have caused another problem, depending on what you've ended up with in .Xauthority). These are about authorizing the connection to the display, but you don't have a display to connect to. You need to figure out why DISPLAY is not set. Do you have anything that changes DISPLAY in your startup file (/etc/profile, ~/.bashrc, ~/.profile, ~/.bash_profile, …)? If so remove it. – Gilles Aug 8 '17 at 22:50
  • Can you still run X programs without going through SSH? (Your fiddling may have broken that. If so I suggest you log out and back in.) What does echo $DISPLAY; ssh -X localhost 'echo $DISPLAY' show? – Gilles Aug 8 '17 at 22:52
  • What distro are you using? – Jakuje Aug 9 '17 at 11:07

Your Answer

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

Browse other questions tagged or ask your own question.