Setting up SSH access to enos.itcollege.ee: Difference between revisions
Line 37: | Line 37: | ||
Or simply use: | Or simply use: | ||
ssh-copy-id your-itcollege-username@enos.itcollege.ee | ssh-copy-id ''your-itcollege-username''@enos.itcollege.ee | ||
You will then be asked to enter your ITCollege password, and then you will be prompted to enter your passphrase (to make sure that you the owner of the private key you are trying to use). | You will then be asked to enter your ITCollege password, and then you will be prompted to enter your passphrase (to make sure that you the owner of the private key you are trying to use). |
Revision as of 14:51, 6 May 2016
This quick tutorial will help you to setup your SSH keys and use them with your Enos.itcollege.ee space. You might be interested to look at this more complete article about SSH also.
Secure Shell, or SSH, is a cryptographic (encrypted) network protocol to allow remote login and other network services to operate securely over an unsecured network (no clear text). You can SSH to Enos using your password, but having the secure keys setup goes faster if you have to login many times (and it looks cool).
With SSH, you generate two keys: one Public and one Private. The public key is not secret, anybody can have it if they want to. Whereas your private key is very important and must not be shared! Your public key is not secret because it must be stored in each server/computer/device you will want to access with your private key. The public key is like the same lock that you install at the front-door of all your houses/apartments (suppose you have many). To enter all those houses/apartments you only need your private key (which only you possess).
By default your keys are stored in the home folder, in a hidden directory called .ssh where the public key is stored in the file id_rsa.pub and your private key in the file id_rsa.
Generate new keys
ssh-keygen -C "write your comment here"
-C
is to set a comment for this key: for example you can write "Enos key" or "Private server". Don't forget the double quotes in your comment.
Then you will be asked where to save the key. We suggest you save it in the default location by just hitting Enter
.
You'll be asked to enter (and to confirm) a passphrase. A passphrase is like a password to make sure that your private key will remain secure even if somebody steals/copies it. We strongly advise you to create a long one (you can use any character you like) and remember it.
After you enter a passphrase, review the fingerprint, or id, of your SSH key. Your keys have been created! You should see the id_rsa.pub and id_rsa files in your .ssh
directory.
Take a look at your public key to see what it looks like:
cat ~/.ssh/id_rsa.pub
Notice your comment at the end of the key.
Copy your public key to Enos
Now you need to copy your public key, and append it to the file "authorized_keys" of your enos.itcollege.ee space. The following command does that:
cat ~/.ssh/id_rsa.pub | ssh your-itcollege-username@enos.itcollege.ee 'cat >> .ssh/authorized_keys'
Or simply use:
ssh-copy-id your-itcollege-username@enos.itcollege.ee
You will then be asked to enter your ITCollege password, and then you will be prompted to enter your passphrase (to make sure that you the owner of the private key you are trying to use).
The authorized_keys file, like its name says, stores the public keys that are allowed to access the host you are using (your enos space in our case).
That's it! Now you can access your Enos space without entering your password: ssh your-itcollege-username@enos.itcollege.ee