Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

How to generate a ssh key pair

  1. Run PuTTYgen either via "Start menu" or "Run command" dialog ( Win+R key stroke)

PuTTYgen in Start menuImage Added

PuTTYgen in Run dialogImage Added
  1. You should generate either "RSA" or "Ed25519" key. "RSA" keys will give you the greatest portability, while "Ed25519" will give you the best security but requires recent versions of client & server.

image103.pngImage Added

image104.pngImage Added

  1. Then click the "Generate" button, and start moving the mouse within the window. PuTTY uses mouse movements to collect randomness. You may need to move the mouse for some time, depending on the size of your key. As you move it, the green progress bar should advance. Once the progress bar becomes full, the actual key generation computation takes place. This may take from several seconds to several minutes. When complete, the public key should appear in the window.

image105.pngImage Added

image106.pngImage Added

image107.pngImage Added

  1. Next, enter your email address in the field "Key comment" and a passphrase in "Key passphrase" and "Confirm passphrase". Do not set a blank passphrase!After that, click on button "Save private key" and choose where to save your generated key ("C:\Users\username\.ssh\test-key.ppk" in this example).

image108.pngImage Added

image109.pngImage Added

image110.pngImage Added

  1. Now it is time to add the new ssh public key to your physics account. Select the key in the field "Public key for pasting into OpenSSH authorized_keys file", copy it and save in a text file.

    • If you are using one the Department Computers: bring the saved file on a usb stick and run

      Code Block
      languagebash
      test -d ~/.ssh || mkdir ~/.ssh; chmod 0700 ~/.ssh; cat /path/to/file >> ~/.ssh/authorized_keys.
    • If you are working remotely: send the saved file to science.it@mcgill.ca, and specify your name, department, and the machine(s) you want this on.

image111.pngImage Added
  1. If you did not configure a loadable session in PuTTY yet, please do it now.

    • First, enter the hostname under the tab "Session" > "Hostname": one of our jump-hosts, or on your department PC.

    • Next, your username in "Connection" > "Data" > "Login details" > "Auto-login username"

    • Uncheck "Connection" > "Data" > "Attempt keyboard-interactive auth (SSH-2)"

    • Check "Connection" > "SSH" > "Auth" > "Authetication parameters" > "Allow agent forwarding"

    • Set path to the private key in "Connection" > "SSH" > "Auth" > "Authetication parameters" > "Private key file for authetication"

    • Finally, save the session with an appropriate name ("Physics-calys" in this example)

image115.pngImage Added
image116.pngImage Added
image117.pngImage Added
image118.pngImage Added

image119.pngImage Added

  1. Now it is time to test the connection with ssh key. You will be prompted for the passphrase of your ssh private key.

    image120.pngImage Added