Samstag, 18. April 2009

SSH forwarding with PuTTY and Xming under Windows

First of all, you should never install any X-Server on a Server.
Because you don't need an X-Server on a Server and it is a security risk to install an X-Server.
On the other hand you will save the memory and cpu power when you don't install an X-Server on your Server.

So normally you install the X-Server on your PC or Laptop and use SSH to allow your Server to use this X-Server.

Under Linux it is very easy, but under Windows you need some additional Tools.

1.) Install PuTTY (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)

For me PuTTY is the best windows ssh client with come will all tools you needed.
When you install the "putty-0.60-installer.exe" Packet, the you have include all needed tools to generate keys, copy files over ssh.

2.) Install an X-Server for Windows (http://sourceforge.net/projects/xming)

I prefer XMing, because it is a standalone X-Server for Windows, but when you use Cygwin a lot and have install it, you can also use the X-Server from Cygwin.
But please keep in mind that XMing need a little bit less resources and have a few more features.

You need the following Packets:
Because we have install "PuTTY" please select "Don't install an SSH Client" in the Setup of Xming.

After you install "Xming" please use the default selection when you install "Xming-fonts".
The Setup will asked you if you wan't to start the X-Server you can simple say "Yes" and you will see the following icon in your tray.

3.) Configure PuTTY

The next Step is to configure PuTTY, simple load your existing Configuration or create a new Configuration.

Terminal -> Keyboard -> The Backspace key -> Contronl-H



Connection -> SSH -> Enable compression
Connection -> SSH -> SSH protocol verion -> 2 only



Connection -> SSH -> X11 -> X11 forwarding -> Enable X11 forwarding



Connection -> SSH -> Tunnles -> R6000 127.0.0.1:6000




Hint:
Save your configuration so that you need to do this only once. ;)

4.) Check SSH-Server Configuration and Export for Display

The last step, you should add or changed the following options in your SSH-Server Configuration:

/etc/ssh/sshd_config
...

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
...

When you check the config and restart your SSH-Server, please login with PuTTY and the Options from "Configure PuTTY"

After you login, simple type the following command:

Elma:~# export DISPLAY=127.0.0.1:0.0
Elma:~# xclock

Now the "xclock" should be display on your Windows Screen over ssh.
You can also set the "DISPLAY=127.0.0.1:0.0" as default value so that you don't need to insert it every time.

Tipps and Tricks:
You can use every X Tool over this way, also gparted can be used to changed or resize the partitions of the server.

Every X Tool will execute on the Server, so please keep in mind that you can open OpenOffice over this way, but the files will save on the Server and not on your PC.

Keine Kommentare:

Kommentar veröffentlichen