How does ssh -X function?

The executable is run on the remote machine and displayed (drawn) on the local machine. What ssh -X remote does is start up a proxy X11 server on the remote machine. If you do echo $DISPLAY on the remote machine, you should see something like localhost:21.0. That is telling the program running on the remote machine to send drawing commands to the X11 server with id 21. This then forwards those commands to the real X11 server running on the local machine, which draws on your screen. This forwarding happens over an encrypted ssh connection, so they can't be (easily) listened to.

Unlike Windows, Mac OS, etc, X11 was designed from the beginning to be able to run programs across a network, without needing things like remote desktop. For a while, X11 thin clients were popular. It is basically a stripped down computer that only runs a X11 server. All of the programs run on some application server somewhere.

Tags:

Ssh