ssh-keygen -t rsa -b 2048
ssh-keygen -t rsa -b 4096
“Enter file in which to save the key (/home/samiux/.ssh/id_rsa): (Hit Enter)”
“Enter passphrase (empty for no passphrase):”
Enter your password twice.
Copy the content.
SSH to your server. At the
sudo mkdir .ssh
sudo nano /home/username/.ssh/authorized_keys
Then pasted the previous copied key onto the authorized_keys file. Save it.
Still at the server.
sudo nano /etc/ssh/sshd_config
Change the following settings as is.
sudo /etc/init.d/ssh restart
When you login to the server again, you will ask for your RSA key passphrase once. Later, you will not be asked for any passphrase or password.