One of the most appealing things about running a home network for me, is the ability to remotely administer and interact with any machine on the network, from a single terminal – in my case, an EEE PC.
Using SSH, It is incredibly simple to set up a ‘headless’ (computer box without a monitor or keyboard) workhorse to carry out any number of tasks for you. The said box can then be tucked away, somewhere out of the way and just be accessed remotely from another computer.
In this post we’ll be using it to download torrents.
So, you’ve installed you’re favourite linux distro onto the soon to be headless workhorse. now what? Well, there are 2 things we will need to do to set up this machine for remote connections. Firstly if you plan on running this machine without a monitor, there is no need to run X – all it does is waste CPU cycles and potential increase your power bill. So, enter the following command into a terminal for a command line boot up only:
sudo update-rc.d -f gdm remove
This tells the computer not to initiate X on start up, it doesnt remove it from your system. This command can be undone with
sudo update-rc.d -f gdm defaults
The other important thing that we need is the SSH server. Almost all distros come with an SSH client, for connecting to remote servers, but they don’t generally come with an SSH server to enable them to receive incoming connections, so it needs to be installed. Easily done, enter the following in a terminal to install the SSH server (debian and ubuntu derived systems):
sudo apt-get install openssh-server
N.B. Always run the commands
sudo apt-get update
sudo apt-get upgrade
before installing new packages
OK, now the server machine is setup, we can access it from another computer, say a laptop. Your other linux machine should have openssh-client pre installed. If not, install it with
sudo apt-get install openssh-client
. The next step is to actually establish a connection. and the way that we discuss that here, is through a LAN.
On the client machine, open a terminal, and type
ssh -L username hostname
where username is the login name for the server that you wish to login under, and hostname is the name of the computer on the network. After this you will be asked a question regarding keys, you need to respond with ‘yes’ in order to continue. After that, enter the password for the given username of the remote server and you will connect.
You are now looking at the command prompt for the remote server, and the prompt should look something like username@hostname
You are now able to interact remotely with the server. you can perform any action that you could were you sat infront of the actual server.
Before we go any further, I want to talk about GNU Screen. Screen is a terminal multiplexer that allows multiple terminal sessions to be opened within a single terminal – think of it a little bit like ‘tabs’ in firefox or IE – you open just one browser, but can have many different pages going on at once. Except its far more useful than just that it allows you to maintain active terminal sessions on a remote server, even after you have logged out. Then, later on resume once reconnected. Absolutely invaluable when using SSH.
So. now that we are connected to the server, the smart thing to do is run screen. Next, we need to get rtorrent up and running rtorrent can be installed using
sudo apt-get install rtorrent
if you have any trouble getting rtorrent working, see this post
You are now ready to download torrents remotely