XDISPLAY Over SSH With Putty & Xming/VcXsrv - UxOra
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 with yum 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.0su 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.
# Check if MIT-MAGIC-COOKIE-1 key has been added [root@oralab01]$ xauth list oralab01.uxora.com/unix:10 MIT-MAGIC-COOKIE-1 1a1f7af9b7ca3c11183b529e51529e51 # Change user with su [root@oralab01]$ su - oracle # Add the MIT-MAGIC-COOKIE-1 from previous command [oracle@oralab01]$ xauth add oralab01.uxora.com/unix:10 MIT-MAGIC-COOKIE-1 1a1f7af9b7ca3c11183b529e51529e51 xauth: file /home/oracle/.Xauthority does not exist # Check if MIT-MAGIC-COOKIE-1 key has been added [oracle@oralab01]$ xauth list oralab01.uxora.com/unix:10 MIT-MAGIC-COOKIE-1 1a1f7af9b7ca3c11183b529e51529e51 # Set DISPLAY variable [oracle@oralab01]$ export DISPLAY=localhost:10 # Display a x11 gui app [oracle@oralab01]$ xclock &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 - oracleOr 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 fontsetIf 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.
Từ khóa » Xming Vs Vcxsrv
-
Difference Between X Servers In Windows - Super User
-
VcXsrv Windows X Server Reviews - 2022 - SourceForge
-
Xming VS VcXsrv - Compare Differences & Reviews? - SaaSHub
-
X Servers For Windows - TeamDynamix - University Of Michigan
-
Can Someone Point To A Decent X Server For Windows? - Hacker News
-
4 VcXsrv Alternatives And Competitors - AlternativePedia
-
Running X Applications Via SSH And VcXsrv, Cygwin Or Xming In ...
-
Xming Alternatives And Similar Software - AlternativeTo
-
VcXsrv Windows X Server - Black Duck Open Hub
-
Xming X Server For Windows - Official Website - StraightRunning
-
Xming - Wikipedia
-
Xsrv+PuTTY On A Stick - Spinal Cord Research Centre
-
X Apps Running In WSL Randomly Stop Displaying On X Server In ...