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
X Server
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.
SSH/Telnet client
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
Under Session:
- Select SSH
- Select "Default Settings"
- Click Save button
On remote Linux
SSH session
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:
xauth list
- Make sure DISPLAY is set to:
export DISPLAY=localhost:10
- Try to display something like:
xclock &
(if not present, install it withyum install xorg-x11-apps.x86_64
)
An xclock like below should display on your windows desktop :
Note
Please note that display number DISPLAY=localhost:10
should match with the one in xauth list
.
Because it can be different from 10.
Tips
SU command
After a 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 su
command.
Or you can use the following command before executing the su
command:
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.
HTH,
Michel.
About MIT-MAGIC-COOKIE-1
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.
Please connect with one of social login below (or fill up name and email)