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?
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: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.