Launching Remote GUIs over SSH: SSH provides a CLI, but sometimes you just need a GUI too

One of the things that I love about living in a Unix environment is that 99% of the time, remote administration only means a quick trip to the console. That’s 99% of the time where my desktop can look something like this:

Home Sweet Terminal

Of course, 99% doesn’t quite make a whole. There’s the matter of the other 1% of the time where a GUI is required. Earlier on in my journey with Linux, I would have tried to setup a VNC server or to work around the need for a UI. With time however, I’ve found a better, faster solution. Let’s bring the GUI to us over SSH! And before you ask, no, I’m not mental.

With one small command, we’re going to use X tunneling to run the UI for our remote application on our local machine, spanning the network in-between.

ssh -X -C

At least part of this command should look familiar: we’re connecting via secure shell to as jdoe. What about the two flags though? -X tells ssh to allow X Windows to run over this connection. -C tells SSH to compress data as possible. While -C, isn’t strictly needed, when forwarding a GUI, it can make the difference between a struggling connection and a usable one.

When the terminal comes up, launching the application remotely should bring up the GUI locally.


Remotely forwarding virt-manager.

And there we go! While it definitely uses a bit more bandwidth than Remote Desktop, this doesn’t really pose a problem when connected to a LAN.