Download User`s Guide - Canadian Web Hosting

Transcript
Advanced Tasks
261
Using X Windows to Run Graphical Applications
The X Window System lets you start any X application inside any Virtual Private Server on a
TCP/IP network and have it show up on your local computer where an X server is installed. To
run remote X applications, you should first of all tell the X applications running inside your
Virtual Private Server to direct their output to the display of your local computer. You can do it
by specifying the DISPLAY environment variable inside the VPS. For example, to run the
xfig drawing program inside your VPS and display its output on your local computer with the
IP address of 199.199.199.199, you should issue the following commands inside the VPS:
# DISPLAY=199.199.199.199:0
# export DISPLAY
# xfig &
Along with setting the DISPLAY environment variable inside your VPS, you should also open
permissions to your X server so that X applications are allowed to use your local display. You
can do it in one of the following ways:
ƒ
By using the host list mechanism (xhost). In this case the X server maintains a list of hosts
which are allowed to connect to it.
ƒ
By using the magic cookie mechanism (xauth). In this case the X server allows access
from any host having an authorization record (a magic cookie) stored inside the server.
ƒ
By forwarding X connections via ssh.
You can choose any of these ways to remotely run your X applications. However, by using the
xhost and xauth mechanisms, authority records needed to establish a connection between an
X server and X application are transmitted over the network with no encryption, whereas using
ssh enables you to run X applications over encrypted connections. So, if you are worried that
someone might snoop on your connections, you can use the X forwarding mechanism, as is
shown in the example below.
Let us assume that you wish to run the xclock application inside VPS 101 and display its
output on your local computer with the name of my_local_computer.my-domain.org.
To this effect, you should perform the following operations:
Note: Before running X applications inside a VPS on a public network, check that this VPS is
accessible from your local computer where the X server is to be run.
1
On your local computer, execute the startx command:
# /usr/X11R6/bin/startx
This starts an X server with a basic terminal window (the default xterm application) on
your computer.
2 Once xterm is open, you should establish an ssh connection to a Virtual Private Server
where you wish to run the xclock application: