Login to your server as root.
As the root user, edit the sshd_config file found in /etc/ssh/sshd_config:
Add the following line to the file, you can add it anywhere but it’s good practice to find the block about authentication and add it there.
Save and exit the file.
Restart the SSH server:
systemctl restart sshd
service sshd restart
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/soumitrakayal/.ssh/id_rsa):
/Users/soumitrakayal/.ssh/id_rsa already exists.
Overwrite (y/n)? Y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/soumitrakayal/.ssh/id_rsa.
Your public key has been saved in /Users/soumitrakayal/.ssh/id_rsa.pub.
The key fingerprint is:
The key's randomart image is:
| ..o |
| * E |
| * + |
| o = . |
| o .S o...