Configure SSH key-based authentication….!!!

Configure SSH key-based authentication


Instead of connecting through login/password to a remote host, SSH allows you to use key-based authentication. To set up key-based authentication, you need two virtual/physical servers that we will call server1 and server2.

1) Configuration Procedure

STEP:-1  On the server1, create a user user01 with password user01:


STEP:-2  On the server2, create the same user with password user01:


STEP:-3  On the server1, connect as this new user:




STEP:-4  Generate a private/public pair for key-based authentication :



STEP:-5 Still on server1, copy the public key to server2 :




STEP:-6 On the server2, edit the /etc/ssh/sshd_config file and set the following options:






2) Testing Time

STEP:-1 On the server1 as user01, connect to the server2:


Leave a Reply

Your email address will not be published.

%d bloggers like this: