Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active December 21, 2020 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plembo/50dece413b9d21f93fbb9d59bc93baf0 to your computer and use it in GitHub Desktop.
Save plembo/50dece413b9d21f93fbb9d59bc93baf0 to your computer and use it in GitHub Desktop.
Use ssh -X

Use ssh -X to launch gui apps remotely

Launching remote gui apps on Ubuntu 18.04 TLS can be easy as

$ ssh -X test1.example.com

Back in the bad old days of Unix when X Windows was first being developed, it was decided that having the ability to remote into a machine and launch graphical apps was a good idea. All versions of X11 have retained this capability to one degree or another, but it's one of the features dropped by the Wayland project.

You need a few prerequisite packages for this to work, but the following are the bare minimum:

xauth
xorg
xterm

In my last fresh install of Ubuntu Server, xauth was already installed. Installing the other two should also install the balance of the required prerequistes ("xorg" is a big meta package that contains most of it).

One of the arguments made against remote X sessions is that they aren't secure. That's true, if you use the native facility in X. But it is not if you use an ssh tunnel: which is exactly what the ssh -X command does.

In practice you'll find it's best to open one xterm remotely, and then launch a second from within it. This way you can launch and potentially kill additional X apps (like, say, firefox) from the second xterm without having to connect all over again.

This article contains a fairly complete discussion of alternatives for running gui apps remotely on Ubuntu Server, and is worth a read if you're just starting out: Server GUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment