There are times when it is just quicker, easier or even necessary to use a graphical application, and there are also times when you might be away from the computer that has your crucial applications installed. Whatever the scenario, Linux and other operating systems running an X server have the ability to forward a graphical application through SSH. Following a few simple steps, you can run a remote application in all of its full graphical glory.
Installation and setup
Before you begin you need to make sure that SSH client and server are installed on the correct computers. The host computer that will have the actual running applications needs to have SSH server running. On Ubuntu, it is not installed by default. Look for the packaged called “openssh-server” and install it. On the client computer, you will need “openssh-client“.
The other important preliminary step is to make sure both computers are connected to a network and that you can reach them via SSH. If the computers are in the same building, it will be easy. If not, you might have to configure the host computer to receive SSH connections through the firewall. See your router’s documentation for the correct method of port forwarding.
1. Open a terminal emulator: Gnome terminal, Konsole or something similar.
2. Now connect to the host computer. As an example, if the host IP address is 192.168.254.76 and the host username is “bobolina”, you would type the following:
This tells SSH to forward the X server calls to the client computer.
3. At the password prompt, enter the password.
4. Run the application. For example, if you want to run Kwrite, just type the command:
(Note: you will need to have “dbus-launch” before KDE 4 applications. Other applications that do not require D-Bus should work without it).
That is all it takes. You should now be able to run remote X applications at will. This can be very helpful if, for example, you are running a computer with a very small hard drive, no hard drive at all or even one without a CD-ROM drive, all of which are common with many netbooks and low-cost mini desktops.
To automate this process, you could setup SSH public keys to connect without passwords and write an executable script. Also, if you need a full X session forwarded, you can use NX technology, available with the commercial NoMachine NX or with FreeNX (a free and open source alternative).
As with any network solution, security is always a concern. Using SSH provides a secure connection, but it does little good if your password is easy to guess and your firewall allows anyone to gain access to it. Once you have a secure plan in place, remote X forwarding is an excellent way load remote applications on demand and manage remote machines. The possibilities are only as limited to your imagination and the speed of your network connection. Experiment with different techniques, and let us know what you discover.