Usually I prefer to do thing directly from the Linux terminal but sometimes there is a need for remote graphical tools and X11 forwarding. Linux supports X Forwarding with no extra software, on OS X you need e.g. XQuartz and on Windows you need two pieces of software: a secure shell program (ssh) to establish the remote connection and an X Server to handle the local display. Here we concentrate on Windows and use Xming and PuTTY for those tasks.
Using Xming for X11 forwarding on Windows
There are different tools to do X11 forwarding on Windows but Xming is small, fast and simple software for X Window System Server for Microsoft Windows. You also need program like PuTTY or FuTTY to create the remote connection.
After you have Xming installed and started check what the icon says on the taskbar. Mine says “Xming Server:0.0″ so for PuTTY settings we get “0.0”. It might also be “0:0″.
Next open Putty and in the Category list go to
- Connection > SSH > X11
- Check X11 forwarding: [x] Enable X11 forwarding
- Add to the “X display location” field: localhost:0.0
Choose Session in the Category list and add your Linux hostname and select SSH. Click Save and then Open the SSH connection to your remote host.
On the remote machine check that the X11 forwarding works with e.g.
-bash-3.2$ xeyes &
X11 forwarding as other user
That’s the typical use case but if you change to another user and try the same command you get error “MIT-MAGIC-COOKIE-1 data did not match”. Go back to previous user and check what the
xauth list says. Take note of that line as you need it later.
-bash-3.2$ xauth list your.linuxmachine.foo/unix:10 MIT-MAGIC-COOKIE-1 38dcf9f9fd5b587f3d5fa8d77281f66c
Login again as another user e.g.
-bash-3.2$ sudo su - oracle and add the original users MIT-MAGIC-COOKIE to xauth.
-bash-3.2$ xauth add your.linuxmachine.foo/unix:10 MIT-MAGIC-COOKIE-1 38dcf9f9fd5b587f3d5fa8d77281f66c
After that the command
-bash-3.2$ xeyes & as oracle should work.
If you get error,
-bash-3.2$ Error: Can't open display:, correct the DISPLAY variable like:
-bash-3.2$ DISPLAY=localhost:10.0; export DISPLAY
Now you can run e.g. Oracle’s Database Configuration Assistant (DBCA) to setup a new database remotely with X11 forwarding: