Thursday, July 14, 2011

How to enable GUI while connecting to Remote Redhat / Linux machine using Putty

Hi, This post cover details about how we can enable GUI interfacing using Xserver while connecting to Remote Redhat 5.6 / Linux Machine using Putty on Windows based local machine.

First all of you need to install Xserver in your local box. Here is the download location for Windows. Here Xserver will be installed using Xming.
Location :  http://sourceforge.net/projects/xming.

After downloading install the Xming server in your localbox and run it with option ":0 -clipboard -multiwindow -ac". To do this, right click the short cut of Xming -> go to properties -> and in target  its should look similar to this "C:\Program Files\Xming\Xming.exe" :0 -clipboard -multiwindow -ac (here double quates are part of the string itself), depending on the location of Xming installation path may change.

On Redhat / Linux machine has feature called X11Forwarding, depending on the value of this parameter it enables or disables the display of graphics on the server.

On Redhat / Linux machine
For example, 
  1. login on Linux/BSD system called myserver.mydomain.com
  2. Open /etc/ssh/sshd_config file using text editor:
    1. # vi /etc/ssh/sshd_config
  3. Find out parameter X11Forwarding and set it to yes:
    1. X11Forwarding yes
    2. Save file & exit shell prompt
  4. Restart sshd service under Debian Linux:
    1. # /etc/init.d/ssh restart
    2. Alternatively, if you are using Fedora / Red Hat Linux restart sshd:
    3. # /etc/init.d/sshd restart

Client Side Setting on Windows Machine
For connecting to Redhat Linux box I am using the most popular SSH client putty. Below are the steps to configure putty on Windows machine.

  1. Run the putty.exe
  2. provide Host Name (or you can use IP address of host machine as well
  3. Select SSH as Connection Type 
  4. Port should be 22 default
  5. Enter again the same name as you entered in Hostname in to Saved Session Input box.
  6. In Connection Category, Find out the Connection Tree. In SSH, expand it and you will see "Enable X11 Forwarding".. 
  7. Enable X11 Forwarding by selecting the check box
  8. X Display location  should be set to localhost:0
  9. Save this entire information as a session by click on Save button
  10. Now start the Xming Server on location machine
  11. Now connect to the Redhat / Linux Machine using saved session from putty
  12. And to verify that Graphics are enable use this command xclock &
  13. You should be able to new graphical window coming up.
Now you are all set to roll, you can execute and run any GUI based application from the Redhat / Linux box and it will get displayed on you local machine. Makes your life much easier :) cheers

No comments:

Post a Comment