Instructor: Ding Yuan
Course Number: ECE344

Home
Discussion (piazza)
Lab Documentation
Lab Assignments
Schedule and Lecture Notes
Grades (UofT portal)

Operating Systems

ECE344, Winter 2017
University of Toronto


Setting Up SSH Keys

You will be using ssh for accessing your SVN repository. If you do not use ssh keys, SVN commands will require typing your password, and some commands may require typing your password more than once. 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/*

Before issuing the first svn command, run ssh-add. This command will ask you for your ssh passphrase. After that, when you issue SVN commands, you should not be asked for the lab machine password.