SSH Key Setup Guide

These instructions should work on all kinds of systems (mac/windows/linux), you can use Windows terminal (Powershell) instead of putty.

The official College of Engineering tutorial on this topic should work, but the Windows solution might not work for two reasons:

Step 1: Generate SSH Key

Run the following command and press enter three times, unless you want to save your rsa key pair with a specific name (by default it's id_rsa.pub) or want to use a passphrase for extra extra security (fun fact- passphrase is used to encrypt the key locally with AES-128)

ssh-keygen -t rsa

Step 2: Transfer Public Key

Replace ONID with your OSU login/user id/username, then authenticate with password and Duo (Don't forget the : at the end of command)

scp -pr id_rsa.pub ONID@access.engr.oregonstate.edu:

You might get an error like The system cannot find the file specified. if you do not(lucky you), it's all good, proceed to step 3

In case you do get the error, look at the result of Step 1 and find something which says Your public key has been saved in C:\Users\xyz/.ssh/id_rsa.pub This is your file path.

Run the command again with this file path, now it'd be something like

scp -pr C:\Users\xyz/.ssh/id_rsa.pub ONID@access.engr.oregonstate.edu:

Step 3: Log Into Server

Authenticate once more with password and Duo, I promise this is the last time.

ssh ONID@access.engr.oregonstate.edu

Step 4: Setup on Server

Now that you have logged into the server (flip), execute these commands given below in order, one by one

mkdir -p ~/.ssh
cat id_rsa.pub >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Step 5: Test

SSH again to test, from a new window of terminal/powershell. It should connect without password/Duo:

ssh ONID@access.engr.oregonstate.edu

If this does not work, or you feel stuck, feel free to email me at anklesan@oregonstate.edu with title - "CS 475/575"