Before generating new SSH key pair first check if you have an SSH key on your local machine.
If there are existing keys, please move to Step 3
Press Enter to accept the default file location and file name.
The ssh-keygen
will ask you to type a secure passphrase. This is optional. If you don't want to use a passphrase just press Enter
Verify the SSH keys are generated correctly, you should see two files id_rsa
and id_rsa.pub
under ~/.ssh
directory.
DO NOT upload or send the private key.
You will now need to copy your public key to Oscar. There are two ways to acomplish this.
If your OS comes with the ssh-copy-id
utility, then you'll be able to copy your public key into Oscar as follows:
You will be prompted for a Password. The public key will be appended to the authorized_keys
file on Oscar.
If you used a custom name for your key instead of the default id_rsa
then you'll need pass the name of your key to ssh-copy-id
i.e.,
If your system does not come with the ssh-copy-id
utility installed, then you'll need to copy your public key by hand.
Get the contents of id_rsa.pub
file. One option is to use cat
in your teminal
cat id_rsa.pub
.
Copy the contents of this file to your clipboard, as we need to upload it to Oscar.
Login into Oscar via regular ssh ssh <username>@ssh.ccv.brown.edu
. Once you are on the login node, open the authorized_keys file with your text editor of choice e.g.,
vim ~/.ssh/authorized_keys
or
nano ~/.ssh/authorized_keys
Add your public keys to end of this file. Save and exit.
If everything went well, you will be logged in immediately withouth prompting you for a password.
Open PuTTYgen (this comes as part of the PuTTY package), change the 'Number of bits in a generated key:' to 4096 (recommended), then click 'Generate'
2. Move your cursor around randomly in order to "salt" your key, while the key is being generated. Once the key is generated, you should see something like this:
3. Replace the text in the 'Key comment:' field with something recognizable and enter a passphrase in the two fields below.
4. Copy the text in the 'Public key for pasting...' field (the text continues past what is displayed) and paste it wherever the public key is needed. If you are using GitHub, you can now create a new SSH key in your Personal Settings and paste this text into the 'Key' field.
5. Click on 'Save private key' and select a logical/recognizable name and directory for the file. Your private key is saved in the selected file.
6. Open Pageant (also part of the PuTTY package). If a message saying "Pageant is already running" is displayed, open your system tray and double click on the Pageant icon.
To open your system tray, click on the up arrow (looks like: ^ ) icon at the bottom right of your screen (assuming your taskbar is at the bottom of your screen).
7. Click on 'Add Key' and select the file you saved when generating your key earlier (Step 5). If it is requested, enter the passphrase you created at Step 3 to complete the process.
In order to not have to add the key to Pageant after every time your machine reboots, you can add the key file(s) to your Windows startup folder (the directory for the current user is C:\Users\[User Name]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup). You may still be prompted to enter the passphrase after a reboot, but you will not have to find and add the key to Pageant every time.
How to set up SSH key authentication.
When connecting from a campus network to sshcampus.ccv.brown.edu
you can set up SSH keys as a form of authentication instead of having to enter your password interactively. Follow the insctructions below that correspond to your operating system/connection method.