CUCC Expedition Handbook

Key-Pair Setup

As of the server move in spring 2019 you need authorisation on the expo server to log in. This takes the form of an ssh key. You generate a key-pair on the machine you use for access, then send the public half to the server. Once done all logins are automatic - no passwords needed.

'ssh' is 'secure shell' and is widely used for secure access to machines and services.

What do I need to do?

You will need to run ssh-keygen/PuTTYgen on your device, email the public key to someone who already has ssh access (Wookey, Paul Fox, Philip Sargent, Sam Wenham). Once installed by them you should be able to log in as 'expo' over ssh (and other software like git will also use this behind the scenes). This only needs doing once (for any machine you want access from).

Our own documentation for installing PuTTy on Windows.

Explanation of key-pairs and the ssh-keygen command.

A public key file looks like this: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApc9+PAMrDtWa8D8/ZneLP2X9UOYmTITAhTd2DRs8SE+NDgis5pYo/Xhtbrg86ePMAC2YM5xAkYx3jNA/VZ/PkB3gTzYJW3T/zTH+cc7YeWhy9l1zIMaYqeyvw7FxeSBaR4XoLPVtVUlai8DUDiWAEm7VvOKj1n68z1LxVh1MZXLm7btckf6fske2YU9UpjqT++AURQvFheRJ4la7KBJ7LXZ3A/TQ7HQaTpqmcQKCiRj/yZ5FNHxBk0M+ShbHUtz1GhXRCMJ3LZHaw24OJyVJ8YNzBiStBb1qcWCXX7HR9CUNhz7tA5HZyc1lau/1vwk8MSe93lyyLntzJKkqmkW/cQ== wookey@khi.e. a long string of characters with 'ssh-rsa' at the start and an ID at the end (often 'user'@'machine').


On a Windows machine use puttygen, which is part of PuTTY. You need to install that if you don't already have it.

Follow the Puttygen instructions, but the really short version is:

  • Run PuTTYgen
  • Click on 'Generate'. Follow the instructions. Don't bother adding a passphrase.
  • Type your name in the 'Key comment' field. (just so we know who's key it is)
  • Save the private key (this will create a .ppk file that you will need later)
  • Don't save the public key - instead copy all of the text from the 'Public key for pasting +into OPENSSH authorized_keys file' field, and paste that into the email. Make sure not to miss part or add newlines or otherwise mess with it.
  • Run Pageant (it will have been installed in your Start menu, otherwise find it it "C:\Program Files\PuTTY\pageant.exe"). Click the "Add Key" button. Select the .ppk file in the pop-up file list. You only need to do this once.


    1. You need openssh-client installed - it's it extremely likely to already be installed. If not (as root/with sudo) apt install openssh-client.
    2. You may already have a key on this machine. If you already have ~/.ssh/, then send that.
    3. If not, run ssh-keygen. It may ask about passwords: you can add a password for extra security, but a passwordless key is fine, and more convenient.
    4. That will create a file: .ssh/ in your home directory. Email that file to one of the admins listed above.


  • Erm, dunno...please fill in
  • Android


    Your second machine

    OK, you have an uploaded and usable key and you can ssh into the expo server. If you want to connect from another machine (e.g. your phone) it's better to make another key than try to re-use the first one. You don't need a nerd admin now, you can do this yourself. But be extremely careful to follow this exactly. If you innocently rename the files to something that appears more sensible it won't work.

    1. On your new machine, generate a key-pair. Since you are probably using a different operating system on your second machine, read the instructions above for the relevant OS. Yes you will be generating a new key. Do not re-use the key you had already.
    2. This time though, you will want to be sure that the key has a meaningful label. On Linux this means something like this: ssh-keygen -C "anathema.device@crowley" (if your name is Anathema Device and your new machine is "crowley"). Just click through the questions it asks accepting the defaults. It will tell you what the key files are called and where it has put them.
    3. If you accepted the defaults, the public key will be called and it will be in ~/.ssh/ - check that this is the case.
    4. Now copy the public key file to your first machine, the one that is already set up with a working key-pair setup with the expo server. Using email to yourself is easiest.
    5. Now upload the public key using sFTP (Filezilla configured to use sFTP, which uses Pageant by default) to
    6. Now login to the expo server on your first machine and do these commands:
      Be extremely careful to type ">>" and not ">" in the fourth line below otherwise you will delete everyone's logins. $ ssh
      expo@expo:~$ cd .ssh
      expo@expo:~$ cp -p authorized_keys authorized_keys.backup
      expo@expo:~/.ssh$ cat keys/ >>authorized_keys
      expo@expo:~/.ssh$ tail -n 1 authorized_keys
      This adds your key on to the end of the authorized keys list and prints the last line - which should be your key that you just added.
    7. Now your public key is installed for your second machine. You check that it works by logging into the expo server using ssh from your second machine: ssh .

      Note that by using sFTP like this we avoid having to use a text editor over ssh. If you know what you are doing you can do this of course, but the above process is less likely to cause problems for a Windows user setting up their phone as a second device where they are not experienced with vi or nano.

    Return to Setting up a basic laptop