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.
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 email@example.com
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.
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.
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:
Then log in as an ordinary user and type this:
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 firstname.lastname@example.org
And then type the following:
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.