Using GUI Applications Remotely


The graphical subsystem of Linux, X, is designed to work across a network. If you run Linux on your desktop PC, X still works via a loopback network within your machine (meaning that network commands are sent out, addressed to the very same machine on which they originated). Because of this, it's possible to access a remote machine and run graphical applications on the local machine. The actual work of running the application is handled by the remote machine, but the work of displaying the graphics is handled by the local machine.

Configuring ssh for Running X Applications on a Remote Computer

Once again, the problem of unencrypted communications rears its ugly head. Simply connecting to a remote computer via X across the Internet means any confidential data might be intercepted along the route of the data. To solve this problem, you can configure ssh so that X applications on the remote computer can be run on the local machine via the ssh connection. This is a two-step procedure:

  • First, on the local machine, you must configure the local X server so that it allows remote applications to run (technically speaking, you're allowing remote X connections). On many Linux installations this isn't necessary, but SUSE Linux deactivates this function as a security measure. However, it's easily reactivated by entering xhost +.

  • After this, you must log in to the remote machine using ssh, but specify the -X flag, which will allow X traffic as well as ssh shell traffic to pass between machines:

    ssh –X knthomas@192.168.0.11

When you're logged in, you can simply start any application by typing its name as usual. The only difference is that the program will appear on the screen of the local machine, rather than the remote machine, as shown in Figure 34-2.

image from book
Figure 34-2. You can run GUI programs on a remote machine across an ssh connection.

Using X across the Internet or even a local network isn't very fast, and you can expect delays when you open menus or if the screen must frequently redraw. However, it can prove very useful.

Running the KDE Desktop Across an X Server

It's even possible to run the entire KDE desktop across an X server. On the local machine, switch to run level 3 (text-only mode) by typing the following as root user:

init 3

Then log in as an ordinary user and type this:

xinit

This will start a rudimentary X session, complete with an xterm shell window. You can then use the ssh command to log in to your remote machine, specifying that X communications should be allowed over the connection:

ssh -X knthomas@192.168.0.11

And then type the following:

startkde

This will make the remote computer's KDE desktop appear. Once again, it will be fairly slow to respond to mouse clicks and keyboard strokes, but it should be just about usable.




Beginning SUSE Linux from Novice to Professional
Beginning SUSE Linux: From Novice to Professional
ISBN: 1590594584
EAN: 2147483647
Year: 2005
Pages: 293
Authors: Keir Thomas

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net