When i first tried setting this up on my Windows PC, it didn't work out of the box. After some troubleshooting under the help of ChatGPT, i figured it out — so here are a few tips that might help you too!
1. SSH with X11 Forwarding
When connecting to your remote server, use the -X (or -Y) flag to enable X11 forwarding:
ssh -X user@remote-hostcheck that the DISPLAY variable is set after login:
echo $DISPLAY You should see something like localhost:10.0
2. Install X11 libraries on the remote machine
On the remote host, make sure the necessary X11 packages are installed:
sudo apt uodate
sudo apt install x11-apps python3-tk
To test if it's working, run:
xeyesif the eyeballs show up, X11 is working!
3. Local machine must have X11 server (macOS or Windows)
macOS
Install XQuartz
After install, run XQuartz and reconnect using:
ssh -Y/-X user@remote-hostWindows
If you're on a Windows system, you'll need to install an X11 server like:
Here's how you set up VcXsrv:
- Download and install VcXsrv
- Run "XLaunch"
- Select:
- Multiple windows
- Start with "Start no client"
- Enable "Disable access control" (or configure access if needed)
- Finish and leave it running in the background
Now, to connect:
- Use MobaXterm or PuTTY with X11 forwarding enabled
- Important: Windows CMD and PowerShell donot support X11 forwarding directly. You'll need to use WSL or an SSH client that supports X11.
No comments:
Post a Comment