You can login to a remote Linux server without entering password using ssh-keygen.
Create public and private keys using "ssh-keygen" on local-host. ssh-keygen have two algorithm tsa and rsa.
Create public and private keys using "ssh-keygen" on local-host. ssh-keygen have two algorithm tsa and rsa.
root@manivel-admin:~# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): -->Press Enter
Enter passphrase (empty for no passphrase): ---------> Press Enter
Enter same passphrase again: -------------> Press Enter
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
94:94:60:5a:5f:e8:ef:7f:6d:02:3b:f9:88:39:d2:6f root@manivel-admin
The key's randomart image is:
+--[ RSA 2048]----+
| +..o. |
| + ooo |
| . .+ |
| .. |
| S. |
| . . |
| o + . |
| . +oE.o o|
| .o=++.o |
+-----------------+
root@manivel-admin:~#
Copy the public key localhost to remote-host using "scp" command.
root@manivel-admin:~# scp -r .ssh/id_rsa.pub test@10.2.12.1:/home/test/.ssh/authorized_keys
Notes: If .ssh directory is not there in /home/test/ .You will create .ssh
We need to set permission for .ssh directory and authorized_keys file in "Remote host".
test@manivel:~$ chmod 755 .ssh/
test@manivel:~$ chmod 644 .ssh/authorized_keys
Login to remote-host without entering the password
root@manivel-admin:~# ssh test@10.2.12.1
[Note: SSH did not ask for password.]
test@manivel:~$ [Note: You are on remote-host here]