In this post I am going to show you how to configure SSH key based authentication on rhel7/centos7. Configuration of SSH key based authentication is little different in rhel7 compared to traditional method of manually copying public key to another server. Users can login using ssh with password and authenticate using public key authentication.
On every server we have two keys private and public. Private key is used as authentication credentials like password which must be kept secret and secure. Public key we need to copy on the server where user want to login and used to verify private key so public key does not need to be secret.
How authentication happens in SSH key key based authentication. SSH server that has public key can issue a challenge that can only be answered by system who is holding private key as a result user can authenticate without password only with the help of public key and system grant login access to the user.
Use ssh-keygen command to generate private and public key as follows