SSH

Overview

Everywhere in this text where your home directory is mentioned, you should read the .ssh subdirectory in your home directory (i.e. /home/loginname/.ssh). For readability, this is not stated explicitly each time it occurs.
All files mentioned in this text are located in that .ssh directory and there are no other user-files necessary for the normal operation of ssh or the ssh-keys application.

The most important files for the use of ssh are id_rsa, id_rsa.pub, id_dsa, id_dsa.pub and authorized_keys. Below, you will find a description of their use.

On the machine from which you want to establish a ssh connection to another machine (the ssh client):

  • id_rsa: contains the private part of the (default) rsa key with which the connection can be set up
  • id_rsa.pub: contains the public part of the (default) rsa key
  • deprecated: id_dsa: contains the private part of the (default) dsa key with which the connection can be set up
  • deprecated: id_dsa.pub: contains the public part of the (default) dsa key

The private parts are used to set up an ssh connection. These are the things you should keep to yourself ... they are equivalent to the password of your login-account. If you do not protect your key with a passphrase, anybody with access to your private key can login in your name.

With this, the importance of the passphrase is demonstrated: it is used to protect your private key. Because a passphrase can be much longer than a typical password and because there are ways to only have to type in your passphrase once each session, you best choose a passphrase as long and as difficult as possible.

The public parts are the things you must copy to the machine to which you want to connect to (see below). In principal, the public parts can be derived from the private parts and thus have not to be kept in a separate file, but for the ease of use they are stored separately anyway. You do not need to be especially careful with the public parts ... they are often publicly registered with/at a (public) key server.

Whether in a specific ssh connection the dsa or the rsa keys are used, depends on the configuration of both the ssh server and client. The computer lab machines are configured to accept both but nowadays it is deprecated to use dsa keys.

On the machine to which you want to connect to (the ssh server):

  • authorized_keys: contains all public keys that you want to give access to connect to this machine. Because a public key is represented on a single line, this file contains 1 line per public key you allow access.

You probably want to use the machines in the computer lab as well as ssh server as as ssh client (thus connect to them as well as starting connections from/on them) ... in that case, all 5 files described above must all be present in your home directory. You can then use the same key with which you connected to the computer lab machine, also to connect from the computer lab machine(s) to somewhere else.

Generated keys

The tool that copies the keys generated by the web application to your home directory, tries to do this in an intelligent way such that the chance that something is being overwritten that shouldn't have been, is minimal:

  • the generated public keys are added to the authorized_keys file ... nothing is removed from it
    • In this way you always have access to the computer lab machines with (at least) the last generated keys.
    • It is your own responsibility to review that file from time to time and remove the keys that are no longer used.
  • if you do not have ssh keys of your own, the generated keys are copied to/in your home directory.
  • if you make new keys via the web application and in your home directory the previous generated keys are present, than those previous keys will be overwritten by the new ones.
    • In this way, on the computer lab machines always the last generated keys are used.
    • You can create new keys if for instance you forgot the passphrase of the old ones.
    • Mind however that the old public keys still remain in your authorized_keys file ... you should remove them manually yourself if and when they are no longer needed.
  • if you do have ssh keys of your own (and thus already have id_dsa* and/or id_rsa* file in your home directory), the generated keys are not copied.
    • Existing id_dsa* and id_rsa* files are not overwritten (except in the above case where they are the same as the previous generated ones).
    • In this case it is your responsibiliy to copy the new keys there yourself, or to rename or delete your own keys, such that the generated ones can be copied the next time the key copy tool is being run.

Both the private and the public parts of the key are copied in your home directory. In this way you have the complete key at your disposal in the computer lab. Thus, you can use that same key to connect from one machine in the computer lab to another (or to any other computer you have configured access to with the public key in the authorized_keys file or equivalent).