Linux Know-How provides a collection of introductory texts on often needed Linux skills.


How to X-window remotely?

  • Start X-server on the local machine, e.g.

xinit

  • From the x-terminal give the remote machine the permission to display on your local screen:

xhost name_of_the_remote_server

In the really secure environment of my house, I could even give all servers the permission to display on my screen using (don't do it when connnected to the Internet):

xhost +

  • Telnet the remote server.

  • Start an X-program on the remote server directing the display on your local screen, for example, you may start a window manager:

startkde -display local_machine_name:0.0 &

The symbol "&" puts the command in the background, so that your telnet window is still available to you.

The 0.0 means "display zero, screen 0", which is your first screen on the first display and makes sense since you can have many concurrent sessions of X running on your computer with Linux.

You don't have to specify the "-display" option if your environment variable DISPLAY specifies the correct location on your current terminal, which is the case on my systems by default, but not on everybody else's as I am told. You can check your DISPLAY setting using:

echo $DISPLAY

  • After I finish my remote X session, I restore the access control to my X-server using:

xhost -name_of_the_remote_server

or

xhost -

Example. This sequence of commands will run Netscape on the remote machine called marie, directing the display to the X-server with X-windows manager which runs on the local machine hacker:

startx

xhost marie

telnet marie

[login]

netscape -display hacker:0.0 &

[do my stuff]

[logout]

xhost -marie

In principle, you can run a program on any computer on the network, and display the output on any other (not necessarily the one you are sitting at).

I use remote X-windowing a lot to run fat programs (kde, Word Perfect 8, and Netscape) on a slim machine (486-33, 8 MB mem) which would not be able to run those by itself. It is also a convenient and fast way to work with files on a remote system for which the nfs mount is not set up.

X-windows was designed to run remotely over the network. Remote X-windowing is a very powerful tool, on top of being quite a pleasant experience. Try it out.

You can even run a program on a remote Linux (or any Unix) computer and redirect the display to a local MS Windows machine if you install an X-windowing program for MS Windows. For a good overview of choices, see: http://www.linuxworld.com/linuxworld/lw-2000-09/lw-09-legacy_1.html


Last Update: 2010-12-16