|
by Guido Socher (homepage) About the author: Guido loves Linux not only because it is interesting to understand how operating systems work but also because of the people involved in its design. |
Running applications remotely with X11Abstract:
Many first time Linux users think that the graphical desktop under
Linux is just another "Windows" system where you can start
applications and these appear in separate windows. Some people
notice that you can have several desktops but that seems to be it.
The Linux X Window System (X11) is much more than that! It is a
network window system. We will see what new and powerful
possibilities this offers.
|
Every graphical X Window application reads at startup the
environment variable DISPLAY to find out to which computer screen
it should send its graphics. This together with the network
capabilities of the X Window System makes it possible to run
graphical applications remotely. That is you use the CPU power of one
machine while you operate the application from an other one. The
entire GUI (graphical user interface) appears on the machine from
where you operate it. You don't notice that you use 2
computers.
Network speed is of course an issue here but a normal 10Mbit/s LAN
connection is more than enough.
Why would you want to do this?
There are many application of these "network graphics". Companies
use it to remotely operate equipment that might be thousands of
kilometers away and you can use the same application to control it
as if you would just be at site.
You might have 2 computers a fast 1GHz machine and an old Pentium
133MHz. You can enjoy the speed of your new machine although you are
not sitting in front of it. Perhaps you sister is currently sitting
in front of the fast machine and logged in. It does not matter you
still benefit from it.
How does it work?
All the X Window applications, they may be called gimp, xterm,
konquerer, netscape, ... are really network clients that connect to
a server, the X-server. The task of the X-server is to talk to the
graphics hardware, draw the pictures on your screen, read mouse and
keyboard input. The clients (your programs such as gimp,
netscape...) send the server instructions on how to paint the
frames and buttons. In exchange they receive from the server the
mouse and keyboard events. Obviously you need some sort of
authentication otherwise everybody could mess up
everybody else's screen. There are two programs to control the
access:
- xhost: using this program you can allow any user on a given
machine to write graphics to your display. Example: You are sitting
in front of a machine called philosophus. To allow access for any
program on host movietux to your display on philosophus you would
type the command:
xhost +movietux
This must be typed into a shell on philosophus
xauth extract - philosophus:0.0 | ssh movietux
/usr/X11R6/bin/xauth merge
or
scp ~/.Xauthority movietux:
bash:export
DISPLAY=hostname:displaynumber.screennumber
tcsh:setenv DISPLAY hostname:displaynumber.screennumber
export DISPLAY=philosophus:0.0
# take your display with you at remote
login:
# Put it into your ~/.login file
set whoami=`who -ml`
set remhost=`expr "$whoami" : '.*(\(.*\))'`
if ( "$remhost" != "" ) then
setenv DISPLAY "$remhost":0.0
endif
>who -ml
movietux!guido pts/3 Oct 26 21:55 (philosophus.tux.org)
# take your display with you at remote
login:
# Put it into your ~/.bash_profile
whoami=`who -ml`
remhost=`expr "$whoami" : '.*(\(.*\))'`
if [ -n "$remhost" ]; then
DISPLAY="$remhost":0.0
export DISPLAY
fi
Webpages maintained by the LinuxFocus Editor team
© Guido Socher "some rights reserved" see linuxfocus.org/license/ http://www.LinuxFocus.org |
Translation information:
|
2005-01-14, generated by lfparser_pdf version 2.51