Quick article about how to transfer GUI display on local machine over SSH using PuTTY (or KiTTY) and XServer like Xming/VcXsrv.
Before starting, you'll need
- A windows machine (as local machine)
- A Linux machine (as a remote server)
On local Windows
Install one of the X Server below on your local Windows:
Xming: Slower but lighter than VcXrv (https://sourceforge.net/projects/xming/)
VcXsrv: Heavier but faster than Xming (https://sourceforge.net/projects/vcxsrv/)
Once install, just click on the program recently installed and a X logo (as below) will appear on the bottom right notification icons.
It means that the XServer is running in the background.
Install one of theses SSH/Telnet client on your local Windows:
- Putty (https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)
- KiTTY (http://kitty.9bis.net/)
Run the program, and configure it as follow:
Under Connection > SSH > X11 :
- Check Enable X11 forwarding
- Enter localhost:0 for "X display location"
- Check MIT-Magic-Cookie-1
- Select SSH
- Select "Default Settings"
- Click Save button
On remote Linux
From your local Windows, Open ssh remote session on your Linux machine with PuTTY/KiTTY
- Check that MIT-MAGIC-COOKIE-1 key has been added with:
- Make sure DISPLAY is set to:
- Try to display something like:
xclock &(if not present, install it with
yum install xorg-x11-apps.x86_64)
An xclock like below should display on your windows desktop :
Please note that display number
should match with the one in
Because it can be different from 10.
su command, you may have the following error if you try to xdisplay something:
KiTTY X11 proxy: Unsupported authorisation protocol Error: Can't open display: localhost:10.0
su open a new session and it does not transfer the session key, so you'll need to manually add the MIT-MAGIC-COOKIE-1 key after the
Or you can use the following command before executing the
su - oracle -c "xauth add $(xauth list | grep MIT-MAGIC-COOKIE-1 | head -1)" su - oracle
Or do not use
su, but open a new PuTTY/KiTTY session and login with the right user.
Missing charsets warning
Warning: Missing charsets in String to FontSet conversion Warning: Unable to load any usable fontset
If you encounter this warning, set
export LC_ALL=C to remove it.
A key is only available during the current session open by PuTTY/KiTTY.
For each new PuTTY session, a new key will be generated and display number incremented if already used.
Enjoyed this article? Please like it or share it.