jump to navigation

Using X Forwarding on Windows December 9, 2010

Posted by Tournas Dimitrios in Linux.

Until now a few posts where dealing with the concepts of administering a Linux box over SSH protocol , so I assume that you are prepared to get a step further your Linux journey . If you need a refresh to the basics of SSH , read the following articles first :

Most people are stuck running Windows ,but the servers ( development or production ) are mostly deployed on Linux . Whenever an administration task has to be done on the Linux server , a secure connection has to be established (SSH) . Putty is a popular application that creates SSH connections  , from a Windows desktop to any Linux box , of course the administrator must have a medium to advanced knowledge of the Linux terminal to accomplish the configurations .If you log in remotely to the Linux server with (say) PuTTY, then all you get is a single terminal. Worse, you can’t start up graphical programs, because the graphical interface software on Linux is different from that on Windows. We know that windows users  like to make any configurations over a graphical environment (GUI) …. And here begins our journey  .

Configure your Windows computer so that it can run Linux programs remotely that have a graphical interface :

If you set this up correctly, you will be able to use all the programs that you would have used , on Linux server , on your Windows computer. You’ll also be able to run multiple programs on the Linux server at the same time (e.g. a terminal and a text editor) and all of them will show up on your Windows computer. So working on your Windows desktop  won’t be much different from working on the server .

If your desktop computer runs Linux already, you don’t need this document — you just need to know this command:
% ssh -X  ipadress      or       ssh -X  domain-name
where “%” is the terminal prompt. If your computer is a Mac, this document won’t help, but I believe there is an X server that works on the Mac (anyone want to look into this?)
Background :
The Linux graphical windowing system is called X11, also known as X Windows, or X for short. Note that “X Windows” has nothing whatsoever to do with Microsoft Windows. Nada. Zip. Zero. Forget I even mentioned it.

“X forwarding” is a feature of X where a graphical program runs on one computer, but the user interacts with it on another computer. If you’ve ever used VNC or Microsoft’s Remote Desktop, it’s conceptually like that, but it works on a program-by-program or window-by-window basis.

If both computers are running Linux, it’s pretty much transparent. However, if you’re sitting in front of a Windows computer, it’s a little bit trickier — not much, though! All you need is an X server that runs on Windows, and an SSH client, both of which are freely available.
A Note on Terminology :
In X parlance, the “client” is the computer running the program, and the “server” is the computer you’re sitting in front of. This might seem backwards: normally the server is the remote computer that’s serving you.

Think of it this way: the X server is serving you, the human being, to the programs on the remote computer. The client, a program, makes requests of you through the X server by changing its graphical display, and you respond to it by clicking on it or typing into it.

What You Need

  • 1)SSH Client

I’m going to explain how to do this with PuTTY, a free and very powerful SSH client for Windows. You can find it here.

You don’t need to install PuTTY; just put it in a convenient place and run it. You can leave it on your desktop, or put it in “Program Files” and create a shortcut to the program in your Start Menu. Or you can install it if you like.

  • 2)X Server and Fonts :

You can get the standard X.Org X server ported for Windows; it’s called XMing. Download the X server with the fonts package from here : The X server with the fonts package

Now, install the  package . It’s a  nice Windows installer, so this should be pretty straightforward.
Making It Go :

  • 1)Start XMing:

You should have a Start Menu item for XMing. Go ahead and start it. If you’re using a firewall, it’ll ask you if you want to unblock it. You don’t need to.

Look for the “X” icon in your system tray. Hover the mouse over it: it should say something like “Xming server – 0:0”. The last bit should be “0:0”, but if it’s not, pay attention to that and use it below.

  • 2)PuTTY :

I’m assuming you’re currently using PuTTY. If not, there’s some good documentation on the PuTTY website. It’s also very easy to use, so you should be able to start using it without much trouble anyways.

First, open PuTTY. Then, put in your normal settings for connecting to the remote server (LAN or WAN) .

Then, on the left, click on the Connection/SSH/X11 sub-panel. It’ll have a few options. Check “Enable X11 Forwarding”, and in the “X display location”, put “localhost:0:0” in the box (unless you didn’t have “0:0” in the section above: then use “localhost:x:y”, where “x:y” is whatever you saw on the icon). Leave the radio button on “MIT-Magic-Cookie-1”.

Now click back to the main “Session” panel on the left. Put a name (like “CS + XWindows”) in the text box in the middle right below “Saved Sessions”. Click the “Save” button. From now on, you can double click the connection in the list box when you want to connect to CS; you don’t need to do these settings every time.

Press “Open” to start PuTTY. Put in your password or do whatever you do to authenticate. Now run the command   “xeyes &” and   ” system-config-network &” . You should get a big pair of googly-eyes that follows the cursor around and a graphical window to configure your Linux network-adaptor remotely and of course securely . It works!

Configuring securely our Linux network adaptor from the Windows XP desktop :

Tips and Tricks :

  • It’s important to start the XMing server before you try to start the graphical program you want to run. Otherwise, there won’t be anything on your end to draw the windows.
  • You can put an ampersand (‘&’) after any command to make it go to the background: i.e. “emacs &” will start emacs and let you continue to use the PuTTY terminal.
  • Any programs you start in this way will close (and lose your work!) if you close the PuTTY session. So don’t do that.
  • If you need another terminal, instead of running another PuTTY session, try running “xterm &” in your current session. This will create a terminal using the server’s terminal program, and display the window on your computer.
  • You can run any program that you’d start as if you’re sitting in front of one of the terminals of your Linux server .         NOTE: In general, you shouldn’t be running graphical applications over SSH , because they often use a lot more computing power than their non-graphical counterparts  . Please keep this in mind.
  • Very graphics-heavy programs (like, ahem, “mozilla-firefox”) may be somewhat slow. Be patient if you’re on a slow connection; everything will work eventually. Terminals and editors should be reasonably fast, and that’s all you need for most X remote session connections .

See also this site : >>>>>>>



No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s