This article explains how you can arrange login to a remote Linux server without entering a password.
Step 1: Create public and private keys on local-host
First login on the local host as the user that you want to do ssh to remote-host without entering a password.
Then run the command below:
# ssh-keygen [-t rsa -b 2048]
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key] don’t provide passphrase
Enter same passphrase again: [Pess enter key]Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
Now, the Public and Private key has been generated and is ready to share it with remote server so that remote server will recognize this local server and will allow it to login without asking any password.
Step 2: Copy the public key to remote-host
Now copy the public key to remote-host. Specify the remote-user on the remote-host to copy the public key into. This is the user for which you don’t want a password prompt. For now you have to enter once the password for the remote user on the remote host to could copy the public key.
# ssh-copy-id -i ~/.ssh/id_rsa.pub remote-user@remote-host
remote-user@remote-host’s password:
ssh-copy-id appends the keys to the remote-host’s /home/user/.ssh/authorized_key.
Step 3: Login to remote-host without password
# ssh user@remote-host
Now you will not asked for a password.
If ssh is not availbale, install ssh-client by
yum install openssh-clients