PETR KOUT - ENGINEERING AND PHYSICS

MY PERSONAL SITE AND BLOG ABOUT SOFTWARE AND HARDWARE ENGINEERING, AND PHYSICS

X11 Forwarding over Cygwin on Windows

By Petr Kout, October 28, 2012


X11 Forwarding over Cygwin on WindowsYou 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...


  • 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. These are necessary for the X11 Forwarding to work on Cygwin.

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

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

    startxwin

    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.

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

    DISPLAY=localhost:0.0
    export DISPLAY
  • Now you should be ready to SSH into your remote server with access to its window system:

    ssh -Y username@remote_server_ip
  • 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.