Question

I am having an error whenever I try to open an external display through sshing into a linux server. The error occurs in various contexts:

freeglut (./executable): failed to open display 'localhost:22.0' * Program linking with openGL

(gedit:9741): Gtk-WARNING **: cannot open display: localhost:22.0

Essentially anything that requires opening an external display results in the error. From searching on the internet, it has something to do with the display variable and it was originally just 0:0. However, I changed my local ~/.profile to include the line (DISPLAY=localhost:0.0; export DISPLAY) it showed the same error, but with localhost:x:0 rather than just 0:0.

I have xquartz installed, and I'm sshing with -Y flag set. I've tried the -X flag as well and still luckless.

Was it helpful?

Solution

X11 forwarding must be enabled on the SSH server on the Linux system as well. In /etc/ssh/sshd_config set

X11Forwarding yes
X11UseLocalhost yes

Don't mess with the DISPLAY variable yourself, the SSH server internally deals with doing the right authorization settings and will set DISPLAY accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top