Purpose: Many times you may be in situation where you need to display/run your programs (typically ‘X Windows’ program) on  a remote machine from your host (or current) machine.

Scenario: Let’s first set-up the scenario in order to better understand this example

Machine 1  – is the machine on which you would like to display  the program/window of Machine2

IP address of Machine 1-

Machine 2 – is the machine whose display you are going to forward to Machine 1

IP address of Machine 2-

Further, I am assuming that both the machines have Debian (Etch or Lenny) installed with ‘X windows’,  ‘xdm’ login manger and fluxbox.  Although you can have any display or window manager of your choice (Xfce, GNOME, KDE, etc.)

Step 1:

On Machine 1 do the following:

a) If you are using xdm  as login manager do:
# nano /etc/X11/xinit/xserverrc

It should look like this:

# $Id: xserverrc 189 2005-06-11 00:04:27Z branden $
exec /usr/bin/X11/X -nolisten tcp

Now remove the line “-nolisten tcp” which basically tells X to allow “TCP” connections to itself (Machine 1).

Just logout and log back in to activate the above setting.

b) If you are using GDM as login manager do:

i) Logout

ii) Go to “Actions->Configure the login manager-> <Enter Password> ->Security”

Un-check the option “Deny TCP connections to Xserver” like this:

Uncheck Deny TCP connection

Uncheck Deny TCP connection

Click “OK” and log back into your system (GNOME/KDE/Fluxbox)

iii) Give the following command from a terminal window:
#xhost + <ip-address-of-machine2>

#xhost + being added to access control list

Step 2:

On Machine 2,  give the following command:

# export DISPLAY=<ip-address-of-machine 1>:0.0

# export DISPLAY=
# echo $DISPLAY

The above steps tells X Window system that all the displays should be exported to Machine whose IP address is on it display window ‘0’

Step 3:

From Machine 2, run any ‘X’ based utility. I chose to run ‘xclock’ which basically displays a small clock window.

# xclock

And now the magic happens. Normally you would see the display on the same machine (machine 2) but hey, wait……….look at the screen of Machine 1……you should be able to see the clock there….


Step 4: (optional Method)

Instead of step 3 you can also achieve the same by doing the following:
# ssh -X root@<ip-address-of-machine2>
# ssh -X root@

It will log you to shell of Machine 2.  Now give the command ‘xclock’:

Machine2># xclock

As usual, please leave a comment/feedback if you have any. Comments encourages bloggers to post more and keep their spirits high.

Also please don’t forget to rate this post below.

Be Sociable, Share!