Operating Systems

ECE344, Spring 2019
University of Toronto

Labs and website created by: Ashvin Goel
Deadlock

Quick Links

Lab AssignmentsQuercus Website

Setting Up SSH Keys

You will be using ssh for accessing your code repository. If you do not use ssh keys, accessing your repository will require typing your password each time. After a while this becomes a pain. This document describes how you can setup ssh keys which reduces the number of times you will have to type your password.

The first step is to create an RSA private/public key with a tool that comes with SSH on a lab machine:

% ssh-keygen -t rsa

ssh-keygen will then produce the following files in the ~/.ssh directory:
id_rsa (private key) and id_rsa.pub (public key). The output of ssh-keygen will be similar to the following:

% ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
23:b2:20:4b:0c:8a:41:c6:99:22:0a:ee:60:a3:9f:8f user@pxx.ecf

It is obviously a good idea to use a strong passphrase. After this step, when you ssh, it will ask for your passphrase instead of the lab machine password. Your ssh passphrase and the ssh private key should not be made available to anybody.

Next, copy the ~/.ssh/id_rsa.pub file into ~/.ssh/authorized_key2 file.

cd ~/.ssh
cp id_rsa.pub authorized_key2

Next, make sure that your ~/.ssh directory has the correct permissions.

chmod 0700 ~/.ssh
chmod 0600 ~/.ssh/*

Now, run ssh-add. This command will ask you for your ssh passphrase. After that, when you issue any commands for accessing your repository, you should not be asked for the lab machine password.