3 Most Useful Configurations for PuTTY: Window Color Customization, X11 Settings and Connect to WSL

Most developers often need to work with remote server by terminal client. PuTTy is one of most popular open-free software for remote connection. This article is to tell the 3 most useful configurations for Putty, which are Window Color Customization, X11 Settings and Connect to WSL.

Photo by Boitumelo Phetla on Unsplash

I worked on Windows 10 when this article is written. This is a beautified snapshot of PuTTY Configuration. (I don’t like its plain appearance but love its powerful functionalities.)

Figure 1: PuTTY Configuration Interface

Window Color Customization

PuTTy allows to use “ANSI Colours” and “xterm 256-colour mode” and that can be enabled in “Window -> Colours -> General options for colour usage”. Keep them enabled unless you don’t prefer to colorful world or you have a particularly garish application and you want to use default colors.

Figure 2: General Options for Color Usage

To see difference when the options are enabled and disabled, you can run below command in remote server to which you connected:

echo -e "\033[92m OK \033[0m NOK"

When color mode enabled (checked options in Figure 2), you will see “OK” is printed in Green color and “NOK” will be printed in default color. When color mode is disabled, both “OK” and “NOK” will be printed in default color.

Figure 3: When color mode is Enabled, ANSI Code Code is translated: “OK” is Green.
Figure 4: When color mode is Disabled, ANSI Color Code is treated as literal text: “OK” is White.

To customize Colors for your SSH session, you can modify colours in the list located “Window -> Colours -> Select a colour to adjust”. There, you can modify 22 different color attributes in RGB mode.

My personal favorite color scheme(R,G,B):

“Default Foreground”=”180,180,180"
“Default Bold Foreground”=”255,255,255"
“Default Background”=”25,35,55"
“Default Bold Background”=”15,25,35"
“Cursor Text”=”0,0,0"
“Cursor Colour”=”0,255,0"
“ANSI Black”=”0,0,0"
“ANSI Black Bold”=”85,85,85"
“ANSI Red”=”255,185,165"
“ANSI Red Bold”=”255,155,115"
“ANSI Green”=”55,255,55"
“ANSI Green Bold”=”0,205,0"
“ANSI Yellow”=”255,255,155"
“ANSI Yellow Bold”=”255,255,85"
“ANSI Blue”=”125,205,255"
“ANSI Blue Bold”=”75,185,235"
“ANSI Magenta”=”255,195,255"
“ANSI Magenta Bold”=”255,165,235"
“ANSI Cyan”=”155,255,255"
“ANSI Cyan Bold”=”85,255,255"
“ANSI White”=”235,235,235"
“ANSI White Bold”=”255,255,255"

The color scheme can be exported/imported from/to Windows Registry Editor.

To export, you open “Windows Registry Editor” through “Windows -> Run -> Registry Editor” and go to “HKEY_CURRENT_USER\Software\SimonTatham\PuTTY” and right-click, select “Export” and then save it to target directory. For instance, C:\Users\$USER\Fedora_PuTTY.reg.

You can do export after you have finished basic configuration. For example, you need to set “Host Name (or IP address)” and “Port” to specify the destination you want to connect to. You probably need to configure some other items also, such as Auto-login username, Private key file for authentication, and so on. Here is the example to connect to VM Fedora instance created in VisualBox:

Figure 5: Configure Host Name and Port

To reuse customized color scheme, just paste the below content in the exported Fedora_PuTTY.reg file : (Edit by notepad++)


To import the registry file, just double click the PuTTY.reg file.

You will get a popup with warning messages, but no problem and go ahead. When finished, you can double check by open “Windows Registry Editor” through “Windows -> Run -> Registry Editor” and go to “HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions”.

The below snapshot is how PuTTY displayed with my color cheme:

Figure 6: Snapshot for Customized Color Scheme

X11 Settings

The SSH protocol has the ability to securely forward X Window System graphical applications over your encrypted SSH connection, so that you can run an application on the SSH server machine and have it put its windows up on your local machine without sending any X network traffic in the clear.

To use X11 forwarding, we need to setup X Display Server in advance. I use Cygwin/X in this example. To enable all applications to connect to Cygwin/X, we need to add the option -listen tcp to startwin command. Thus, the command to start Cygwin/X looks like:

C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec /usr/bin/startxwin -- -listen tcp"

You can also edit the script /usr/bin/startxwin and add the option to defaultserverargs="-listen tcp" and then no need to add the option in command line:

C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec /usr/bin/startxwin"

When Cygwin/X is started, we can configure X11 for PuTTY.

In PuTTY, you can configure X11 in Connection -> SSH -> X11 Panel:

Figure 7: Configure X11

X display location is not mandatory to configure, its value depends on your X Display Server. By default, it’s blank and will use the value :0.

Then, you can run GUI application from remote server and show the application in Windows. For example, run gedit from Fedora and show it in Windows:

Figure 8: Run gedit by X11 Forwarding

Connect to WSL

WSL provides another option for developers to work with Linux OS in Windows. Here are some steps to setup WSL and then connect to WSL with PuTTY:

> sudo apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
openssh-server is already the newest version (1:7.6p1-4ubuntu0.3).
0 upgraded, 0 newly installed, 0 to remove and 156 not upgraded.
  • Start OpenSSH service on WSL Operating System. E.g. Ubuntu-18.04
> sudo service ssh status
* sshd is not running
> sudo service ssh start
* Starting OpenBSD Secure Shell server sshd [ OK ]
> sudo service ssh status
* sshd is running
  • Check OpenSSH Port
> grep -i ^port /etc/ssh/sshd_config
Port 60022
  • Configure PuTTY Session to Connect to WSL Operating System
Figure 9: Configure Host Name and Port of WSL OS

After connection, it looks like:

Figure 10: GUI of WSL SSH Session Connected from PuTTY



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store