/
Using PuTTY on Windows

Using PuTTY on Windows

How to generate a ssh key pair

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

 

  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.

 

 

 

  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.

 

 

 

 

  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).

 

 

 

 

  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

      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.

  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)

 

 

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

Related content

OpenSSH on Windows
OpenSSH on Windows
More like this
OpenSSH on MacOS or Linux
OpenSSH on MacOS or Linux
More like this
Configure Key-based SSH Authentication
Configure Key-based SSH Authentication
More like this
SSH Access
More like this
Secure shell (ssh)
Secure shell (ssh)
More like this
Remote Access
More like this