Monday, February 25, 2013

Setup SSH Private-Public Keys on Unix

  1. Generate Key-Pair using PuTTYGen
  2. Save private key to a safe place.  
  3. Massage the public key into openSSH format by doing the following
    •     Remove lirst 2 line
    •     Remove last line
    •     Join all lines into a single line
    •     Add 'ssh-rsa ' (remember the trailing space) at the start of the line

  4. Copy public key to unix ~/.ssh/authorized_keys file or append to the existing file content
  5. Use PuTTY to select the private key to ssh to the remote server


If using Java library such as JSch to connect using private key, need to export private key into openSSH format first.  Load the private key just created into PuTTYGen and select convertion -> Export Openssh Key option.  Use the openssh format private key in Java code to connect to ssh.


  1. You have touched good quality points here. In whatever way continue writing.
    Addiction treatment Tennessee

  2. You have really selected the suitable topic; this is one of my favorite blogs.Rehab Georgia

  3. I’m trampled by your contents carry on the wonderful work.
    Georgia addiction treatment

  4. Whatever you have provided for us in these posts really appreciative.
    Treatment center Georgia