For Windows operating system user, may refer below guide.


Needed tools :

  1. puttygen.exe (a RSA and DSA key generation utility)
  2. pageant.exe (an SSH authentication agent for PuTTY, PSCP, PSFTP, and Plink)
  3. putty.exe (the SSH and Telnet client)


These are downloaded from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html.


Step 1 - Generating SSH RSA key

  1. Open puttygen.exe
  2. Hit Generate and the public key will appear. Copy this public key and save to your computer.
  3. Save public key to your computer.
  4. Save private key to your computer.
  5. Done.

P/S : Total 3 items to save from b, c and d.


Step 2 - Paste the public key from Step 1-b to Linux server authorized_keys.

  1. Remotely access your Linux CentOS operating system's server through putty.exe. May click this link for the guide.
  2. Run below command to create a folder .ssh
    • mkdir /root/.ssh
  3. Run below command to open authorized_keys
    • nano /root/.ssh/authorized_keys
  4. Paste the public key from Step 1-b to authorized_keys and save the file.

  5. Done


Step 3 - Add the private key to pageant.exe for server remote authentication via SSH key.

  1. Open pageant.exe from your computer and will appear at Windows taskbar
  2. Add private key from Step 1-d
  3. Enter private key passphare that prompts.
  4. Done adding the private key.
  5. Open a new session from putty, entering your CentOS server IP and SSH port
  6. Enter username "root", hit enter to remotely access the server with SSH key.


To security reason, it is recommended to leave SSH password authentication disabled. This simply means that password authentication is disabled and have to use SSH key for remotely accessing server.

  1. Remotely access your server.
  2. Run below command to open SSH configuration file
    • nano /etc/ssh/sshd_config
    • search for PasswordAuthentication
    • change "PasswordAuthentication yes" to "PasswordAuthentication no"
    • save the change
  3. Restart SSH service
    • systemctl restart sshd



The failure login with SSH key demonstration.


The success login through SSH key demonstration.