How I forward displays from Linux or other *nix systems to Windows

First off, I usually try to avoid it, I’m old school and like my command line options.  So, often when I’m installing PeopleSoft components, I use the console options if available.  Sometimes it’s not that simple though so when that happens, I’ve got a pretty standard method of doing things.  So here’s how I forward a display from a Linux server to my Windows workstation.

The X Server

To forward a display you need an X Server to send it to.  There are many on the market, some free, some not free.  I usually install Cygwin on my workstations everywhere I go (hence it’s listed first on my Tools page).  Cygwin allows me to utilize my favorite tools from the  Linux world on my often mandated Windows workstation.  Along with all your basics, Cygwin also includes an X Server.  Perfect, I needed one of them and I don’t have to bug my manager to buy licenses or support.   This almost always is the X Server I forward my display to.

The installation of X for Cygwin is well documented at  This post is not intended to be a cygwin xinit searchCygwin install how-to so I’m going to hit very briefly on how I do this.  I don’t install a lot of options, I’m not running X to run local apps, I’m running it to forward a display to and that’s about it. To setup the X Server, when running the Cygwin setup.exe type xinit in the search field, click on cygwin menu searchthe result to install it, next type menu in the search field, again clicking the result to set it to install.

Forwarding your Display

cygwin X start menuOnce the install is finished, you need to start your X Server. Once it is running I use either OpenSSH or putty to connect to the server.  Both have options to enable X11 forwarding so that the display can be tunneled over the ssh connection.  In order for X11 forwarding to work SSH on your remote server must be configured to allow it.  This is usually configured in /etc/ssh/sshd_config and for security reasons the SSH default is no.  Depending on the distribution/OS though your default config provided by the distro may have it already set to yes.
#X11Forwarding no
X11Forwarding yes
If you installed OpenSSH putty configwith your Cygwin install like I do, you can use it with the –Y option.  Something like
ssh randy@psdb1 –Y
OpenSSH takes care of everything for you, do NOT export DISPLAY=… with this method.

Xeyes! This works great if you need to forward the display of the user you directly log in as.  There is a hoop you must jump through if you are forced to log in as personal account and then become another via sudo or su.  For instance, say I need to login as randy, but I want to run DBCA as the oracle user.  No problem, just a couple extra steps.

  1. log in with X11 forwarding enabled as your normal user
  2. run xauth list
  3. copy the contents to the clipboard
  4. become your new user via su or sudo
  5. run xauth add and paste contents of the clipboard
  6. run your program

Here’s an example

[randy@psca ~]$ ssh -Y’s password:
Warning: No xauth data; using fake authentication data for X11 forwarding.
Last login: Thu Jun 20 23:28:02 2013 from
[randy@psdb1 ~]$ xauth list  MIT-MAGIC-COOKIE-1  fba410a3a7ac3a2be5f874786eb7fda7
[randy@psdb1 ~]$ sudo su – oracle
[sudo] password for randy:
[oracle@psdb1 ~]$ dbca
X11 connection rejected because of wrong authentication.
X connection to localhost:10.0 broken (explicit kill or server shutdown).
[oracle@psdb1 ~]$ xauth add  MIT-MAGIC-COOKIE-1  fba410a3a7ac3a2be5f874786eb7fda7
[oracle@psdb1 ~]$ xauth list  MIT-MAGIC-COOKIE-1  fba410a3a7ac3a2be5f874786eb7fda7
[oracle@psdb1 ~]$ dbca

DBCAIf you find you have multiple entries listed when you run xauth list, you may want to clean them up by hand with xauth remove.  For more simulating history and additional reading material about X check out the wikipedia page X Window System.

Obviously there are alternatives to this.  There’s more than one way to skin a cat as they say.  But that’s how I do it.







Leave a Reply

Your email address will not be published. Required fields are marked *