SSH Password vs Key Based Authentication

What are the benefits of key based authentication?

Key based authentication provides two major benefits.  The first, you can login without a password (If you didn’t set it up to use password protection).  Second, the lack of using a password stops any unauthorized password uses or cracking attempts.  
 

How do I setup key based authentication?

Follow these steps to create a public/private key pair, get them installed and ready for use on your ssh server:

 

  1. Create a key pair on server connection client, for example, PuTTY
    You’ll need to repeat this process for each machine you connect to the server with
This generates two files in your hidden ~/.ssh directory

  1. a. Id_rsa – Your private key
    b. Id_rsa.pub – Your public key
  2. Choose whether or not you want a password upon setup by hitting the enter key or adding one
    Anyone who has access to your local machine will be granted access automatically
  3. Set private key permissions

     
  4. Copy and install your public key (id_rsa.pub) to the servers authorized_keys list
     
  5. Set your server permissions
    Anyone using your local machine will be granted access automatically

     
  6. Set proper SELinux context
     

Share:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.