Skip to content

Instantly share code, notes, and snippets.

@hedaprakash
Last active November 1, 2025 18:07
Show Gist options
  • Select an option

  • Save hedaprakash/910908e59516ea4632e379e340782a02 to your computer and use it in GitHub Desktop.

Select an option

Save hedaprakash/910908e59516ea4632e379e340782a02 to your computer and use it in GitHub Desktop.
X11 Forwarding Setup for VSCode Remote SSH
# X11 Forwarding Setup for VSCode Remote SSH
This guide details how to configure X11 forwarding to enable GUI support when using VSCode Remote SSH.
---
## Steps
```powershell
# 1. Install and Configure Xming on Windows
# Install Xming
# Download and install Xming from https://sourceforge.net/projects/xming/.
# Validate and Set the DISPLAY Environment Variable
# Open Windows PowerShell and run the following commands:
# Check if the DISPLAY variable is already set
[System.Environment]::GetEnvironmentVariable("DISPLAY", [System.EnvironmentVariableTarget]::User)
# Set the DISPLAY variable
[System.Environment]::SetEnvironmentVariable("DISPLAY", "localhost:0.0", [System.EnvironmentVariableTarget]::User)
# Validate the variable again
[System.Environment]::GetEnvironmentVariable("DISPLAY", [System.EnvironmentVariableTarget]::User)
# Validate Xming is Running
# Check for the Xming process
Get-Process -Name Xming -ErrorAction SilentlyContinue
# Ensure port 6000 is listening
netstat -aon | findstr 6000
---
# 2. Configure SSH on Windows
# Create SSH Configuration
# Create an SSH configuration file at C:\Users\hvadmin\.ssh\config with the following details:
Host vstcs
HostName 10.10.50.210
User hvadmin
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
---
# 3. Validate and Configure on Linux (Ubuntu) putty/powershell
# SSH into the Remote VM
ssh vstcs
# Validate DISPLAY Variable
echo $DISPLAY
# Test GUI Forwarding
xclock
# Test Clipboard Sharing
echo "test23" | xclip -selection clipboard
---
# Final Step: Use VSCode with Remote SSH
# Launch a remote SSH session in VSCode and verify GUI elements work as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment