Friday, 29 August 2008

Launching programs from remote computer using ssh

If you have an old laptop lying around that doesn't quite have the juice to run newer programs such as firefox (takes about 250mb to run well), then this howto will show you how to make use of the old girl yet.

Even the latest versions of ubuntu (such as hardy 8.04) can be installed on fairly modest machines with a reduced system (unlike windows or macox). Xubuntu is a easy to use system for older machines that still looks good and has full functionallity. If your machine is really old (like mine) and you have the wherewithal to run shell commands then download the alternative installation cd, install the server version of ubuntu (no graphical interface) and manually install icewm. This is probably on a par with win95 for looks, but is far less thirsty.

This is where the magic begins - although ..... I may have neglected to mention earlier that you'll need a more powerful desktop pc that can run the required software - a small omission I know. Linux has a reasonably simple to use graphical tunneling network system. This means that you can run a program on one machine and view it on another - assuming they are networked. If you have a wireless router then you have the ideal setup.

The required software is ssh (secure shell). You'll need to install it in most ubuntu distributions. Once installed all you have to do is run the following command on the laptop:

ssh -X xxx.xxx.xxx.xxx firefox

Note the -X is uppercase. The xxx.xxx.xxx.xxx is the IP address for the desktop machine. You can usually find this on the router's admin page (often it will be 192.168.0.x or 10.0.0.x). You will need to have a user account set up on the desktop for this to work. However if someone is logged on to that user on the desktop and is using firefox then it won't allow you to start another instance. You may wish to create a new user on the desktop specifically for the laptop to use. If this is the case then you will need to tell ssh to use a different user name with

ssh -X username@xxx.xxx.xxx.xxx firefox

The next step is to create an icon to shortcut this command. Unfortunately this won't work because the command requires a password. However you can remove the need for a password by setting up keys. Here's how.

On the laptop type:

ssh-keygen -t rsa

then press enter at each prompt to set no password.

As you will notice this creates a file called "~/.ssh/id_rsa.pub". This file needs to be copied to the desktop machine so that the desktop machine can authenticate the laptop for future logins.

ssh-copy-id -i ~/.ssh/id_rsa.pub username@xxx.xxx.xxx.xxx

No comments:

Post a Comment