In Enterprise settings, it’s common for analysts to have access to a shared Linux server to which they can offload long-running, computationally-intensive processes, leaving the analyst’s client available for less demanding tasks. In some cases, the Linux server might only be accessible via command-line interface.

In this post, we’ll demonstrate how to setup and utilize X11 forwarding over ssh. In our example, we will forward the jupyter qtconsole via X11 over ssh to our Windows client.

To follow along with this demonstration, these items are assumed to be available and/or installed:

  • A Windows client
  • Cygwin with X Server installed (on the Windows client)
  • ssh access to a Linux Server
  • A graphical application to forward from the Linux Server (gedit, firefox, ipython, etc…)

Setup

From Cygwin on the Windows cleint, enter:

$ startxwin

This starts an X-Server on the Windows client, which enables graphical applications running on the Linux server to be forwarded and displayed locally. A large amount of text will be dumped to the screen. When it completes, enter CTRL + C to get the prompt back.

We’ll need to set the DISPLAY environmental variable in order for the remote application to render. Again from Cygwin, run:

$ export DISPLAY=:0.0

Login to the Linux server via ssh as normal, but include the -X flag, which enables X-forwarding. If you connect to the server using a port other than the standard 22 (say, 3333), specify the X and p flags together followed by the port number:

$ ssh -Xp 3333 username@servername.com

To test whether everything has been setup properly, run:

$ xlogo

The xlogo should render on your screen, which looks like:

xlogo

In addition, you can run:

$ xclock

Which should render:

xclock

If both of these objects rendered on your Windows client, you’re good to go!

If not, it’s possible that X Server wasn’t included as part of your Cygwin installation. Either go back and install it, or , alternatively, download xming, which is an X Window System Server for Windows.

From the terminal connected to the remote server, run the command to launch the jupyter qtconsole:

$ python3 jupyter-qtconsole

Which should result in rendering:

qtconsole