How to configure the passwordless ssh authentication ?
Step 1: .. Firstly we need to create public and private keys using "ssh-key-gen" command on server1.
[abhi@server1] $ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/abhi/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/abhi/.ssh/id_rsa.
Your public key has been saved in /home/abhi/.ssh/id_rsa.pub.
This command will create two files in ".ssh" directory inside your's home directory (in this case it will be /home/abhi/.ssh)
1. id_rsa
2. id_rsa.pub -- this file will contain the public/private key.
Step 2: You need to Copy the public key to the second server(let it's ip be 192.168.20.1) using "ssh-copy-id" command.
[abhi@server1] $ ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.20.1
abhi@server2's password:
Now try logging into the machine, with "ssh 'remote-host'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.
Step 3: Login to remote-host(192.168.20.1) without entering the password
[abhi@server1] $ ssh 192.168.20.1
Last login: Sun April16 12:18:12 2012 from 192.168.20.1
it dosesn't ask's for password.
* Source Article from : Internet
Step 1: .. Firstly we need to create public and private keys using "ssh-key-gen" command on server1.
[abhi@server1] $ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/abhi/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/abhi/.ssh/id_rsa.
Your public key has been saved in /home/abhi/.ssh/id_rsa.pub.
The key fingerprint is:
34:b3:de:af:56:68:18:18:34:d5:de:67:2fdf2:35:g7 abhi@server1
34:b3:de:af:56:68:18:18:34:d5:de:67:2fdf2:35:g7 abhi@server1
This command will create two files in ".ssh" directory inside your's home directory (in this case it will be /home/abhi/.ssh)
1. id_rsa
2. id_rsa.pub -- this file will contain the public/private key.
Step 2: You need to Copy the public key to the second server(let it's ip be 192.168.20.1) using "ssh-copy-id" command.
[abhi@server1] $ ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.20.1
abhi@server2's password:
Now try logging into the machine, with "ssh 'remote-host'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.
Step 3: Login to remote-host(192.168.20.1) without entering the password
[abhi@server1] $ ssh 192.168.20.1
Last login: Sun April16 12:18:12 2012 from 192.168.20.1
it dosesn't ask's for password.
* Source Article from : Internet