X11 Forwarding over Cygwin on Windows

You have a Linux server accessible via SSH, but you need to gain access to the GUI of applications like Gimp, Firefox, etc.? In this tutorial, I will show you how to do this using Cygwin on Windows in a few steps:




1. Go to www.cygwin.com and download the setup package. Install Cygwin on your PC. Make sure to install the following packages:

  • xorg-server
  • xinit

as these are necessary for the X11 Forwarding to work on Cygwin.

2. Once installed, run Cygwin, a terminal window will appear.

3. Start X11 and enable Windows to handle Cygwin/X11 programs by typing:


This will start X11 server and open an xterm window. The following commands should be entered into the xterm window. Also, the X11 server is now running behind stages and you can see it in your tray icon area.

4. Make sure your DISPLAY variable in your client PC is setup correctly. In Cygwin, type:

export DISPLAY

5. Now you should be ready to SSH into your remote server with access to its window system:

ssh -Y username@remote_server_ip

6. Once logged in, run a command opening your GUI program, such as:

firefox &


If it’s not working for you, make sure that X11 Forwarding is enabled on your server. On Debian based systems, open /etc/ssh/sshd_config in your favorite text editor and make sure that in it you find the following lines set like so:

X11Forwarding yes
X11DisplayOffset 10

If not, make the necessary changes and restart the server.

Bookmark the permalink.