Is SSH X forwarding an example of remote port forwarding? I feel like so.
How can SSH X forwarding be done in terms of SSH remote port forwarding command?
Thanks.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityIs SSH X forwarding an example of remote port forwarding? I feel like so.
How can SSH X forwarding be done in terms of SSH remote port forwarding command?
Thanks.
The underlying communication is very similar to ssh -R6010:localhost:6000
... but the X forwarding in SSH does a lot more magic in the background.
For example, what if there was already a service listening on port 6010? SSH will try 6011, 6012.. until it finds a free port.
Then you need to set the DISPLAY variable on the remote end. Which may be localhost:10.0
or localhost:11.0
or... depending on the remote port picked up.
Then you need to handle X authentication (xauth
) to ensure the client sends the right magic cookie expected by the local X server...
With more modern ssh servers and clients the connection may be to/from unix domain sockets instead of TCP sockets, but the concept is still the same.
Basically, the X options of ssh
handle a number of the "house keeping" requirements for an X session... as well forwarding traffic.
/tmp/.X11-unix/X0
Feb 7, 2019 at 11:40