How do I run X programs on another machine?

(NB this is all insecure and for use on your own network)

By default on many installs X disables remote connections with a nolisten parameter to it.

So try and find this by something like sudo grep -n -r nolisten /etc and then comment this out from the appropriate file. Restart X.

Then on a shell on the local machine type xhost + (or alternatively a host name instead of +). Then on the shell on the remote machine type DISPLAY = host:0.0 ; export DISPLAY where host is the hostname of the local machine. Now start your program in the remote shell by typing the commandline startup e.g. openoffice and it will appear on your local desktop.

A better way of doing this; use "ssh -X" when you connect to the remote host. This will set up an encrypted tunnel for programs on the remote system to communicate with the X server, and set up the DISPLAY variable to use it.

What do these X display names mean? eg :

An X display name is in the form: hostname:displaynumber:screennumber


The hostname specifies the name of the machine to which the display is physically connected. If the hostname is not given, the most efficient way of communicating to a server on the same machine will be used.


The phrase "display" is usually used to refer to collection of monitors that share a common keyboard and pointer (mouse, tablet, etc.). Most workstations tend to only have one keyboard, and therefore, only one display. Larger, multi-user systems, however, frequently have several displays so that more than one person can be doing graphics work at once. To avoid confusion, each display on a machine is assigned a display number (beginning at 0) when the X server for that display is started. The display number must always be given in a display name.


Some displays share a single keyboard and pointer among two or more monitors. Since each monitor has its own set of windows, each screen is assigned a screen number (beginning at 0) when the X server for that display is started. If the screen number is not given, screen 0 will be used

What is my display/screen number?

Try the command:

  • echo "$DISPLAY"

See also SSHNotes