How to use ssh keys with putty and Red Hat Enterprise Linux ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 6.3

Issue

  • SSH Keys generated by Putty do not work with openssh in Red Hat Enterprise Linux

Resolution

  • To make it working convert the keys generated by Open-ssh to putty's format:

    • First generate keys on RHEL:
    # ssh-keygen -t rsa
    
    • Then put public key into authorized_keys file:
    # cat public_key >>  ~/.ssh/authorized_keys
    
    • Set proper permissions:
    # chmod 700 ~/.ssh
    # chmod 600 ~/.ssh/authorized_keys
    
  • Copy (for example with Winscp) private key into Windows machine.

  • Start the program called "puttygen", select "conversion" --> "Import keys" --> "your_private_key".
  • Save it somewhere in putty format.

Note: In order to use the converted key please create new putty session and fill the following fields:

  • "auto-login username" (username you wish to use as login) .
  • "connection" --> "ssh" --> "auth" --> "browse" (here please point to your newly generated putty key)-->
  • "session" --> "save".

Root Cause

  • This issue arises from the incompatibility between openssh system used by Linux machines and Putty key-generator.

Diagnostic Steps

  • Keys generated by puttygen, after being added to .ssh/authorized_keys do not work.
  • Rights for authorized_keys have been set correctly to 600.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.