For E.g. want to ssh from linux server-A to the other linux server-B without password follow the below steps.
From the source linux server(linux server-A)
Step1: Login to the server and the the command "ssh-keygen"
Generating public/private rsa key pair.
Step2: Enter the path/location where you want to save the sshkey(you can give any name for saving the sshkey)
Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/sshkey
Press enter key
Step3: You will get "Enter passphrase (empty for no passphrase):" in terminal
Press enter key
Step4: You will get "Enter same passphrase again: " in terminal
Press enter key
Step5: You will get "Your identification has been saved in /root/.ssh/sshkey." in terminal
Your public key has been saved in /root/.ssh/sshkey.pub
The key fingerprint is:
39:3c:3c:68:ca:fb:fc:95:e6:e0:6b:d2:0e:b9:e6:21 root@linux-xwkz
Step6: Enter this command in terminal "vi /root/.ssh/keyname.pub"
Step7 : run the below command to add copied key to the Destination server(linux server-B]
vi /root/.ssh/authorized_keys
paste the key in to "authorized_keys" file
Step8: restart sshd service.
service sshd restart
Now you will able to ssh without password from "linux server-A" to "linux server-B"
From the source linux server(linux server-A)
Step1: Login to the server and the the command "ssh-keygen"
Generating public/private rsa key pair.
Step2: Enter the path/location where you want to save the sshkey(you can give any name for saving the sshkey)
Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/sshkey
Press enter key
Step3: You will get "Enter passphrase (empty for no passphrase):" in terminal
Press enter key
Step4: You will get "Enter same passphrase again: " in terminal
Press enter key
Step5: You will get "Your identification has been saved in /root/.ssh/sshkey." in terminal
Your public key has been saved in /root/.ssh/sshkey.pub
The key fingerprint is:
39:3c:3c:68:ca:fb:fc:95:e6:e0:6b:d2:0e:b9:e6:21 root@linux-xwkz
Step6: Enter this command in terminal "vi /root/.ssh/keyname.pub"
Copy the key
Step7 : run the below command to add copied key to the Destination server(linux server-B]
vi /root/.ssh/authorized_keys
paste the key in to "authorized_keys" file
Step8: restart sshd service.
service sshd restart
Now you will able to ssh without password from "linux server-A" to "linux server-B"
No comments:
Post a Comment