Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code2Pro: How to Forward X11 to Windows 10 via PuTTY & vcxsrv

Code2Pro: How to Forward X11 to Windows 10 via PuTTY & vcxsrv

Scope

Tested on Windows 10 & Ubuntu 16.

Steps

  1. Check that sshd on Ubuntu is properly configured
sudo vim /etc/ssh/sshd_config

The most important line is X11Forwarding yes (it's added by default, but if not, you can add it).

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
# http://develorium.com/2015/05/remote-eclipse-over-x11/
X11UseLocalhost no

Then reload sshd:

sudo service sshd reload
  1. Install vim-gtk3 or other packages that have UI on Ubuntu
sudo apt-get install vim-gtk3

You can also try gnome-terminal.

For more, check: http://packages.ubuntu.com/xenial/x11/

  1. Install VcXsrv Windows X Server
  1. Configure PuTTY
  • Navigate to SSH => X11 => Tick Enable X11 forwarding
  • Pass the value of $DISPLAY (which is 127.0.0.1:0.0) to the field X display location
  1. Launch from Ubuntu
  • Use PuTTy to log in as normal
  • Run gvim for example on the Ubuntu via PuTTY
  • Use the GVim window

References

@SpareSimian

This comment has been minimized.

Copy link

SpareSimian commented Oct 1, 2018

I found it necessary to install xauth on the Linux box (xorg-x11-xauth package on CentOS) to allow the sshd server to accept the X server's DISPLAY variable. Otherwise, $DISPLAY was blank. ("echo $DISPLAY" on the Linux host to test.) Note that the first connection will complain that ~/.Xauthority does not exist. xauth will create that file on the first run.

@revurp

This comment has been minimized.

Copy link

revurp commented Jul 31, 2019

I found it necessary to install xauth on the Linux box (xorg-x11-xauth package on CentOS) to allow the sshd server to accept the X server's DISPLAY variable. Otherwise, $DISPLAY was blank. ("echo $DISPLAY" on the Linux host to test.) Note that the first connection will complain that ~/.Xauthority does not exist. xauth will create that file on the first run.

@SpareSimian This worked for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.