SSH on laptop concept
Eny Setiyowati/Shutterstock.com

Want to remotely access a Linux machine and launch a graphical application? PuTTY to the rescue, thanks to the “enable X11 forwarding” option. You can even do this from Windows—all you need to do is quickly install an X server.

The PuTTY program was initially written for Windows, 20 years ago. It has been ported to many other platforms since. It is a graphical application that provides a terminal window and remote connection to other computers. Typically, the connection is made using SSH, but other protocols are supported.

As well as the traditional terminal window command line interface, PuTTY can be configured to open graphical applications on the remote computer.

Installing PuTTY

If PuTTY isn’t already installed on your computer, you can install as follows.

On Windows, download PuTTY from the web.

To install PuTTY on Ubuntu, use this command:

sudo apt-get install putty

sudo apt-get install putty in a terminal window

To install PuTTY on Fedora, use this command:

sudo dnf install putty

sudo dnf install putty in a terminal window

To install PuTTY on Manjaro, use this command:

sudo pacman -Syu putty

sudo pacman -Syu putty in a terminal window

Using PuTTY On Windows

If you’re running PuTTY on Windows, you’ll have to install an X server before continuing. The rest of the process will then work the same as it does on Linux.

Linux graphical applications rely on an X server to provide a graphical desktop environment. There has to be somewhere for the graphical applications to open and run in. Windows doesn’t have an X server because it doesn’t need one. So we’ll need to install one, just like when launching graphical Linux applications from Windows 10’s Windows Subsystem for Linux.

The Xming X server was used to research this article, and it performed perfectly. Download it and install it. You can accept all of the defaults. It runs as soon as it is installed and appears as an icon in your system tray.

Xming about window

Starting PuTTY

On Windows, you’ll find PuTTY in your Start menu after installing it. On GNOME you can start PuTTY by pressing the Super key—the one between the right hand Ctrl and Alt keys—and typing “putty”.

The PuTTY icon

The PuTTy icon will appear at the top of the screen. Click on it to launch PuTTY.

 

Connecting With PuTTY

The PuTTY window will appear. In the Host Name field, enter the IP address or the network name of the remote computer you are going to connect to. There must be an SSH server running on the remote computer.

the PuTTY window with host details added

In the side pane, scroll down until you see the “SSH” tree entry. Expand this, then expand the “Auth” entry, and highlight the “X11” entry.

X11 Forwarding option

Select the “Enable X11 forwarding” checkbox.

In the side pane, scroll to the top of the list and select the “Session” entry. Type a name for these settings In the “Saved Sessions” text field, then click the “Save” button. Typically you would save the settings under the name of the remote computer so you can easily re-use them for future connections.

Saving PuTTY settings

Click the “Open” button to connect to the remote computer.

The first time you connect to a remote computer, you’ll see a warning that you have not connected to this computer before.

First time connection warning

Click the “Accept” button to complete the connection.

An x-term window will appear. Enter the name of the user account you are connecting as, and press Enter. You will be prompted for the password for this account. Type the password and press Enter.

Logging in to the remote computer in a terminal window

You will be presented with the command line prompt of the remote computer.

To start a graphical application enter its name on the command line with any parameters you want to pass to it. We’re going to use the leafpad editor to edit the .bashrc file.

leafpad .bashrc

leafpad .bashrc in a terminal window

The leafpad editor will open with the .bashrc file loaded in it.

leafpad editor with .bashrc loaded into it

As another example, let’s start the epiphany browser.

epiphany

epiphany command in a terminal window

The epiphany browser will open, and you can browse to a favorite website.

epiphany browser window

And yes, it works on Windows, too! Here we’ve launched the idle python IDE on a remote Linux system. It appeared on our Windows desktop. Just launch it by typing its command like you would on Linux.

The idle python ide

Note that it does not have the usual Windows window decorations. It is a Linux application running on your Windows desktop, with Linux window attributes, courtesy of PuTTY and the Xming X server.

Closing the Connection

To close the connection, close all applications then use the exit command in the PuTTY terminal window.

exit

exit in a terminal window

 

 

That’s Really Quite Impressive

To achieve something so alien as a functioning Linux application running quite happily on a Windows desktop, with a few easy steps, is nothing short of staggering.

Dave McKay Dave McKay
Dave McKay first used computers when punched paper tape was in vogue, and he has been programming ever since. He is now a Data Protection Officer and has worked as a freelance programmer, manager of an international software development team, and an IT services project manager. Dave is a Linux evangelist and open source advocate.
Read Full Bio »