How to open a GUI application remotely with PuTTY

Would you like to remotely access a Linux computer and start a graphical application? PuTTY to the rescue, thanks to the “Enable X11 forwarding” option. You can even do this from Windows – all you have to do is quickly install an X server.

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

In addition to the traditional command line interface of the terminal window, PuTTY can be configured to open graphical applications on the remote computer.

Docker for Beginners: Everything You Need to Know

Install PuTTY

If PuTTY is not already installed on your computer, here’s how to install it.

On Windows, Download PuTTY from the Internet.

To install PuTTY on Ubuntu, use this command:

sudo apt-get install putty

How to install PuTTY on Fedora, use this command:

sudo dnf install putty

To install PuTTY on Manjaro use this command:

sudo pacman -Syu putty

Using PuTTY on Windows

If you are running PuTTY on Windows you will need to install an X server before proceeding. The rest of the process then works the same as it does on Linux.


Linux graphical applications rely on an X server to provide a graphical desktop environment. There needs to be a place where the graphical applications can be opened and run. Windows doesn’t have an X server because it doesn’t need one. So we need to install one, just like we did when launching Linux graphical applications through the Windows subsystem of Windows 10 for Linux.

the Xming The X server was used to research this article and it worked perfectly. Download and install it. You can accept all of the standard settings. It will run as soon as it is installed and will appear as an icon in your system tray.

Xming over window

Start PuTTY

Under Windows you will find PuTTY in your start menu after the installation. On GNOME, you can start PuTTY by pressing the super key – the one between the right Ctrl and Alt keys – and typing “putty”.

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

Connect with PuTTY

The PuTTY window is displayed. In the Host Name field, enter the IP address or network name of the remote computer that you want to connect to. An SSH server must be running on the remote computer.

added the PuTTY window with host details

Scroll down in the side area until you see the tree entry “SSH”. Expand this, then expand the “Auth” entry and mark the “X11” entry.

X11 forwarding option

Activate the check box “Activate X11 forwarding”.


Scroll to the top of the list in the side area and select the “Session” entry. Enter a name for these settings. Click the Save button in the Saved Sessions text box. Typically, you would save the settings under the name of the remote computer so that you can easily 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 will see a warning that you have not yet connected to that computer.

Warning when connecting for the first time

Click the “Accept” button to complete the connection.

An X-Term window will appear. Enter the name of the user account you are connecting to and press Enter. You will be prompted for the password for this account. Enter the password and press Enter.

You will receive the command line prompt on the remote computer.

To start a graphical application, enter its name on the command line with any parameters you wish to pass to it. We are going to use the Leafpad editor to edit the .bashrc file.

leafpad .bashrc


The Leafpad Editor opens with the .bashrc file loaded in it.

Leafpad editor with .bashrc loaded

Than others example, we start the Epiphany browser.

epiphany

The Epiphany browser will open and you can navigate to a preferred website.

Epiphany browser window

And yes, it works on Windows too! Here we have them. brought to life idle Python IDE on a remote Linux system. It appeared on our Windows desktop. Just start it up by typing the command like you would on Linux.

The idle Python idea

Note that it doesn’t have the usual Windows window decorations. It’s a Linux application that runs on your Windows desktop, with Linux window attributes, courtesy of PuTTY and the Xming X server.

How to run GUI applications in a Docker container

Close the connection

to close the connection, close all applications then use the ExitCommand in the PuTTY terminal window.

exit

That’s really impressive

To achieve something as extraordinary as a working Linux application that runs reasonably happily on a Windows desktop in a few simple steps is just breathtaking.

Related Posts