Wednesday, February 11, 2015

SSH X11-Forwarding Step By Step in Centos-6.x

How to do SSH X11-Forwarding :-

In order to run an application on one CentOS 6 system and have it display on another system there are a couple of prerequisites. Firstly, the system on which the application is to be displayed must be running an X server. If the system is a Mac OS X, UNIX or Linux based system with a desktop environment running then this is no problem. If the system is running Windows, however, then you must install an X server on it before you can display applications from a remote system. A number of commercial and free Windows based X servers are available for this purpose and a web search should provide you with a list of options.
Secondly, the system on which the application is being run (as opposed to the system which the application is to be displayed) must be configured to allow SSH access.

From Server :

Before you start  confirm the below packages are installed in your server. Run this command

Step :1

# rpm -qa xorg-x11-xauth openssh 

This will give a output like this :


Step :2

Edit  /etc/ssh/ssh_config file and change ForwardX11 no to ForwardX11 yes

# Vi /etc/ssh/ssh_config

 ForwardX11 yes


# service sshd restart
# setenforce 0
# service iptables stop

From Client :

The first step in remotely displaying an application is to move to the system where the application is to be displayed. At this system, ssh into the remote system so that you have a command prompt. This can be achieved using the ssh command. When using the ssh command we need to use the -X flag to tell ssh that we plan to tunnel X traffic through the connection:

# ssh -X user@hostname

In the above example user is the user name to use to log into the remote system and host-name is the host-name or IP address of the remote system. Enter your password at the login prompt. Once logged in, run the following command to see the DISPLAY setting:

# echo $DISPLAY

The command should output something similar to the following:


To display an application, simply run it from the command prompt. For example:

# gedit

When run, the above command should run the gedit tool on the remote system, but display the output on the local system.

***** Thanks *****

No comments:

Post a Comment