Windows-to-linux: Putty with SSH and private/public key pair

Solution 1:

  • Generate your key with PuttyGen.
  • Right-click in the 'Public key for pasting...' text box and choose select all
  • Right-click again and choose copy.
  • Connect to your host and edit .ssh/authorized_keys, and paste in your key, remove any other pre-existing stuff from when you tried following that video.
  • Verify that your ~/.ssh folder is 0700 with chmod 0700 ~/.ssh/
  • Your authorized_keys file should be 0600 so chmod 0600 ~/.ssh/authorized_keys.

enter image description here

Solution 2:

that means the key exchange did not take place or failed.

please download the cli tool plink.exe (same place you downloaded putty.exe) and do some debugging

plink -v -i yourprivatekeyfile user@server

see what it tells you, in addition to what the server says.

you can do this in a powershell or cmd window.

if you have already generated your default putty public file, you can convert it with

ssh-keygen -i -f yourputtypubkeyfile > openssh.key

to be added to your authorized_keys

Solution 3:

Generate a keypair and store the public key on the server as suggested by @Zoredache. Enter a password for protecting the private key and click Save private key and save the key e.g. in your user profile. Remove permission for everyone except yourself from the key file.

To be able to authenticate with your private key, you need to make it available to PuTTY. Either load it with Pageant or enter it in the PuTTY configuration dialog under Connection > SSH > Auth (click Browse... and choose the file you just saved).

In the same dialog, category Session enter the hostname or IP address of the host you want to connect to in the respective field. Switch to the sub-category Logging and click All session output, then click Open.

When the terminal window opens, right-click on the title bar and select Event Log. This client-side log complements auth.log on the server side and should help you find out what's going on.