The X Window system was developed to allow a network transparent graphical windowing system for UNIX workstations. Your local display uses a miniature network within your workstation to accomplish this (UNIX Domain Sockets).



#yum install lynx xhost


Suppose I want to forward my workstation, remotehost, to the workstation somehost. The first step is to allow X Window connections from remotehost to this machine. This is accomplished using the xhost command. The syntax for xhost is as follows:


#xhost +/- <IP address or hostname>

Add or subtract a host that can display X11 apps on this workstation

#xhost +

Disables all security, any host can display X11 apps on this workstation

#xhost –

Enables all security, no host can display X11 apps on this workstation
Allowing remotehost to connect to somehost you must execute the following command:


[sathish@www.sathish.com]$ xhost + http://www.bhuvana.com


The next step is to login to the remote machine, remotehost in this case, and tell it where to display the X11 applications. There are two components you need to know, the first is the IP address or hostname of the local workstation (the one you are sitting at) and the X11 display number (typically 0). To locate the display number, use xdpyinfo:

[sathish@www.bhuvana.com]$ xdpyinfo | more
name of display: :0.0
version number: 11.0
The :0.0 is your local display number.
Then, using the IP address or hostname and X11 display number you set the remote machine to display to the local machine.
Using bash:



[sathish@www.bhuvana.com]$ export DISPLAY=”www.sathish.com:0.0″
Using tcsh or csh:

[sathish@www.bhuvana.com]$ setenv DISPLAY http://www.sathish.com:0.0

#vi /etc/ssh/sshd_config

#Secure Forwarding: ssh
X11Forwarding yes
#service sshd restart

The best way to forward X applications to your local machine is by using your ssh server. This requires a small amount of setup with the ssh server. You must make sure the line: X11Forwarding yes is present in your sshd_config file.

Once your ssh server has been configured, forwarding X applications is as simple as sshing in to the machine. The ssh server and client take care of all the forwarding details such as your environment varible and display number. There is a small catch: you must use the -X parameter to notify the client and server that you want X applications forwarded:

[sathish@www.sathish.com]$ ssh -X sathish@www.bhuvana.com