One of the reasons I like pair Networks is the shell account. I don’t always need shell access, but it’s really useful to have it when I do need it. Much better than the alternative – needing it and not having it. One question that comes up when you start talking about shell accounts is accessing the thing. For users who are used to Windows, it’s a legitimate question – it’s just not something that you’re typically exposed to.
What you’ll need is PuTTY – a great little application that allows you to connect to an SSH server. SSH stands for “secure shell”, and that’s how you login to most shell accounts. There are some that will allow you to do so with a standard telnet client, but that’s less than secure, so don’t do that. The only problem with PuTTY is that you have to type your password every time you need to connect. That’s not a bad thing if you don’t do it often, but if you disconnect and reconnect a lot, it can be a royal pain. Enter Pageant (available at the same page as PuTTY).
Pageant is known as an SSH authentication manager. That’s a big mouthful, so in simpler terms, it keeps tracks of keys. It’s like that keychain you have in your pocket – only it’s for logging into accounts online. The only difficulty is you have to create your own keys, since most often, those accounts won’t have them already. Doing so can be a bit unwieldy, even if you deal with this sort of thing on a regular basis, but it’s not a difficult process.
First, you need one more piece of software: PuTTYgen. PuTTYgen is a key generator – it allows you to create a pair of keys, one private and one public – so that PuTTY can establish a session with a remote server and login. After you start the application, you’ll need to generate some randomness with your mouse. Then type a passphrase, and type it again to confirm. Finally, save the private key file to disk because you’ll need it later.
Now that you have your key, look up towards the top of the PuTTYgen window. You’ll see a section that’s labeled Public Key for Pasting into OpenSSH authorized_keys file. It’s another mouthful, to be sure, but that’s what we need to connect to our pair Networks server. Copy the text and paste it into a file called – you guessed it – authorized_keys. Be careful here, because the contents of this should all be on one line, and there is no file extension.
Next, using whatever means you prefer, copy this file to your server. I suggest FTP of some sort, since copying it one character at a time can get pretty tedious (it’s about 225 characters long). You’ll want to create a directory called .ssh (that is dot-ssh) in your home directory, and place the authorized_keys file there. This tells your account to look up that file whenever you connect. It’s all automatic, so long as the file is in the right place.
Remember, put this in your home directory – not in your web directory. At pair, your home directory is somewhere like /usr/home/foo, while your web directory is /usr/www/users/foo. Put it in /usr/home/foo/.ssh, and don’t forget the “.” before the ssh. If you come from a windows background, it’s going to look odd – and in fact, Windows won’t let you create a directory with only an extension and no filename – but you can do it on your pair account, and that’s where you need to put it.
Once that’s in place, you need to start up Pageant. This interface is a bit simpler than that of PuTTYgen, but that’s okay. All you need to do here is click the Add Key button and find the private key that you saved earlier. You did save it, didn’t you? If you didn’t, go back and save it. If you closed PuTTYgen without saving, you’ll need to redo everything, including the upload to your pair account, since it’s virtually impossible to recreate the random movements of the mouse used to create your key pair.
Once you have selected your private key, enter your passphrase to open the file, and then you’re set! Authentication is ready to happen, as soon as you tell PuTTY how it should login. So open your PuTTY installation and we’ll take care of that next.
Click on the Data option under Connection, and you’ll see an option where you can enter an auto-login username. Enter your username here. Then go back to the Session screen, enter a host name (or IP address) and a session name, then click Save to save this value as a default. Now whenever you open this session, and start your session, it will automatically realize who you are and since Pageant is running it will log you in.
If you’ve been paying attention, you may realize that if Pageant isn’t running, then you won’t be logged in. At this point, you can simply type your password – or you can have Pageant start up automatically. All you need to do is create a shortcut that looks like this:
Pageant.exe keyfile.ppk
And put it in your startup folder. That will load the key file keyfile.ppk at startup (it will prompt you for the keyphrase), so that you don’t have to start it. You should also add a path to Pageant.exe so that it can find the file – I just shortened it here for illustrative purposes.
Also, if like me you have to sign into multiple systems, you can actually have Pageant keep track of several keys – that’s the whole purpose after all. It doesn’t make a lot of sense to go through all of this for just one login, and that’s where the whole setup really shines.