1. Create your key

    Note
    Do you have already ssh keys? On the CS machines, cd into your ~/.ssh directory and type ls. Do you have files named something like id_??? and id_???.pub? If you do, skip the reminder of this section.

    The first step is to create a public/private key pair on the CS network.

    • Log into a CS machine from your laptop or the CS lab

    • On the CS machine, run ssh-keygen.

    • Accept the default save location

    • Type a password you will remember. It does not need to be the same as your Swarthmore password or your CS password.

      Here is some sample output from running it:

      $ ssh-keygen
      Generating public/private ed25519 key pair.
      Enter file in which to save the key (/home/user1/.ssh/id_ed25519):
      Enter passphrase (empty for no passphrase):
      Enter same passphrase again:
      Your identification has been saved in /home/user1/.ssh/id_ed25519
      Your public key has been saved in /home/user1/.ssh/id_ed25519.pub
      The key fingerprint is:
      SHA256:........................................... user1@rosemary
      The key's randomart image is:
      +--[ED25519 256]--+
      |  ..            .|
      |    o          ..|
      |      . . * .o  o|
      +----[SHA256]-----+
  2. Set up your authorized_keys file.

    Note
    Do you already have a file called authorized_keys in your .ssh directory? If so, and you’re not sure how to proceed, let us know.
    $ cat id_ed25519.pub >> authorized_keys
  3. Use scp to copy your public/private key to your personal computer. These instructions were tested on a Mac. Please let us know if the instructions differ on Windows so we can adjust the instructions.

    • open a Terminal

    • cd into the .ssh directory

    • copy these keys to your local machine:

      $ cd
      $ cd .ssh
      $ scp user1@cslab.cs.swarthmore.edu:.ssh/id_ed25519.pub .
      $ scp user1@cslab.cs.swarthmore.edu:.ssh/id_ed25519 .
  4. Add your keys to the ssh-agent. This step is different on a Mac vs on Windows:

    • On a Mac, type the following to add your key to your Keychain. Type your ssh key password when prompted.

      $ ssh-add --apple-use-keychain
      $ ssh-add -K  # USE THIS ONLY IF THE FIRST LINE FAILED
    • On Windows, first open PowerShell as an Administrator. Then, type the following which will (a) start the ssh-agent service by default when you reboot, (b) start the ssh-agent service now (before your next reboot), and (c) add your key to Windows. Type your ssh key password when prompted:

      $ Get-Service ssh-agent | Set-Service -StartupType Automatic
      $ Start-Service ssh-agent
      $ ssh-add