To start with: we need to generate a public & Private key on the Client Host.
Cautious: Take a backup of authorized_keys file from .ssh folder before generating keys and keep it in safe place, this will override with the current one and follow the below steps.
Option “-t” for type and RSA is the protocol for key generation and default key is 2048 bits. You can change the default key value of your choice mentioning with option “-b” and value of key.
This will create .ssh directory in user’s home directory and generates the public and private key.
.ssh/id_rsa – Private key
.ssh/id_rsa_pub – Public key
Copy the public key to remote host for passwordless SSH using ssh-copy-id command. This will copy public key to remote host on authorized_keys file.
# ssh-copy-id -i ~/.ssh/id_rsa.pub email@example.com
Above command will copy public key to remote host in authorized_keys file under .ssh folder. Verify whether public key is copied on remote host.
Testing passwordless SSH
After copy public key to remote host you should be able to login to the remote server without prompting password.
[oracle@teclues ~]$ ssh firstname.lastname@example.org
In this tutorial, passwordless SSH in Linux
. Big thanks for reading all the way to the end. Please share it with Your Friends & Help Someone… and also Like Our Facebook Page
. Let me hear your thoughts in the comments below!