Monday, December 7, 2009

Use PuTTY and XMing to see Linux graphics via SSH on your Windows computer

Do you use SSH to connect to a remote Linux machine from your local Windows computer?  Ever needed to run a program on that Linux machine that displays graphical output, or uses a GUI? I was in this position last week trying to make figures using ggplot2 in R of results from an analysis of GWAS data which required using a 64-bit Linux machine with more RAM than my 32-bit windows machine can see.

You try plotting something in R on a Linux machine in an SSH session you'll get this nasty error message:

Error in function (display = "", width, height, pointsize, gamma, bg,: 
X11 I/O error while opening X11 connection to 'localhost:10.0'

Turns out there's a very easy way to see graphical output over your SSH terminal.  First, if you're not already using PuTTY for SSH, download putty.exe from here.  Next, download, install, and run Xming.  While Xming is running in your system tray, log into the Linux server as you normally would using PuTTY.  Then type this command at the terminal to log into the linux server of your choice (here, pepperjack), with the -X (uppercase) to enable X11 forwarding.

ssh -X pepperjack.mc.vanderbilt.edu

If all goes well you should now be able to use programs that utilize graphical output or interfaces, which are running on the remote Linux machine rather than your local windows computer.




Xming - PC X Server

Xming download link on SourceForge

13 comments:

  1. Hi,

    I recommend this site:
    http://www.cse.unsw.edu.au/~helpdesk/documentation/Putty.html

    to see another way to use Xming with Putty.

    Regards,

    Federico Antico
    PhD Student
    https://engineering.purdue.edu/~zavattie/

    ReplyDelete
    Replies
    1. thanks for sharing it .. it worked perfectly

      Delete
    2. Not able to access the link.
      http://www.cse.unsw.edu.au/~helpdesk/documentation/Putty.html
      Can you please update..

      Delete
  2. I have been trying to find a workaround for this problem for ages and never realized just how simple the solution was. Thank you for this.

    ReplyDelete
  3. It is certainly very useful to be able to send a graphical output to a remote Linux machine. Many thanks for this one guys.

    ReplyDelete
  4. "ssh -X server" is not necessary after enabling putty forwarding X11.

    ReplyDelete
  5. Thanks a lot!!

    and thanks to http://www.cse.unsw.edu.au/~helpdesk/documentation/Putty.html also!

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Thanks for the post. It helped a lot. Keep up the good work.

    The link http://www.cse.unsw.edu.au/~helpdesk/documentation/Putty.html holds an easier fix to this problem ..

    ReplyDelete
  8. How can I save R images generated using putty (linux server) in Xming view ?

    ReplyDelete
  9. thanks.
    Also the following page has very detailed steps about using xming, xshell, putty, tightvnc to display linux gui on windows desktop (x11 forwarding when behind firewall)

    ReplyDelete
    Replies
    1. Looks like you forgot to add the link.

      Delete
    2. Sorry, the page is at http://www.doxer.org/learn-linux/use-xming-xshell-putty-tightvnc-to-display-linux-gui-on-windows-desktop-x11-forwarding-when-behind-firewall/

      Delete

Note: Only a member of this blog may post a comment.

Creative Commons License
Getting Genetics Done by Stephen Turner is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.