Pair key is formed from public key and private key
The public key is placed in the server so that when the client connects, there must be a new private key server for the connection. This process helps to secure the server if unfortunately the ip is exposed and the password is detected.
Step 1: Use putty to run ssh key pair, select RSA 2048, click Generate to start generating keys



Step 4: Then open it up and copy the key off

Step 5: Go to the server to create the .ssh file with the command
mkdir .ssh

touch authorized_keys
![]()
vi authorized_keys
![]()
Step 8: Then paste the key pair

Step 9: Next, reset the ssh file with the command
vi / etc / ssh / sshd_config
![]()
Step 10: Edit the config file to
PermitRootLogin prohibit-password
PasswordAuthentication no

Step 11: Restart the service to update the config file using the command
systemctl restart sshd.service
![]()
Step 12: Go to putty, go to Connection>SSH>Auth then click Browse to select the saved ssh key

Step 13: login to the server using ssh

Step 14: Try to log in with another machine and immediately report an error

Conclusion
We have just completed the basic steps to install Pair key on ssh, here we can remote ssh securely with Pair key.


Tiếng Việt