I am trying to do some X11 forwarding and I got completely lost. I found very good answers explaining the theory:
- What is the $DISPLAY environment variable?
- https://unix.stackexchange.com/questions/17255/is-there-a-command-to-list-all-open-displays-on-a-machine
- https://superuser.com/questions/368530/understanding-x-windows-display-environment-variable-when-tunnelling
But I'm still straggling when applying it in practice.
Here is what I did:
- Opened
mobaxterm
which creates a X server on my machine (Windows, shouldn't matter). ssh -X server1
echo $DISPLAY
giveslocalhost:10.0
xeyes
- opens a window on my local machine. Great, but why doeslocalhost
direct to my machine? Shouldn't it beserver1
?
As far as I understand localhost
is equal to 127.0.0.1
which is the local address. So if I'm connected to server1
shouldn't it look for X-server on server1
?
localhost
in this context refers to the loopback address of the remote machine - as explained underX11UseLocalhost
in thesshd_config
man page – steeldriver Dec 11 '19 at 13:37