I was created SSH and stored in the /.ssh/id_rsa location and also copied the id_rsa.pub to child node. used chmod 700 for .ssh and chmod 600 for /.ssa/id_rsa.pub.
Now I am trying to connect childnode without password but still it is asking password for connect the child node.
I would like to connect the child node without password but no luck. Are any IP settings needed ?
Please let me know.
From "node1" host where you created the "id_rsa.pub" file you will need to push it to other hosts where you want to do passwordless ssh.
[root@node1 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub firstname.lastname@example.org [root@node1 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub email@example.com [root@node1 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub firstname.lastname@example.org
Else as another alternative you will need to copy the contents of file "~/.ssh/id_rsa.pub" and paste it to the other hosts in the following file "~/.ssh/authorized_keys" (If this file does not exist there already then you will need to create one and then paste the contents of "id_rsa.pub" from node1 to this file "~/.ssh/authorized_keys" of all hosts:
i am explaining the concept with 2 servers(server1,server2)
in server1 you need generate ssh keys and private key must stored in /home/user/.ssh with 400 permission
in server2 you need to copy authorizedkeys(copy of id_rsa.pub) in /home/user/.ssh/)wiht 600 permsssion.
Now you can able to do ssh server2 from server1 without enter the password
I think @Joy's using ssh-copy-id would be the easiest.
If server doesn't have ssh-copy-id, you can do below:
ssh email@example.com "echo `cat ~/.ssh/id_rsa.pub` >> /root/.ssh/authorized_keys"
ssh firstname.lastname@example.org "echo `cat ~/.ssh/id_rsa.pub` >> /root/.ssh/authorized_keys"
ssh email@example.com "echo `cat ~/.ssh/id_rsa.pub` >> /root/.ssh/authorized_keys"
Follow below steps it worked for me.
1) Generate the ssh-key from "root" user
$sudo su - root
it will create "id_rsa.pub" and "id_rsa".
2) Before copying, please check are you able to ping the host
#ping target_hostname, if you able to ping the target directory
copy "id_rsa.pub" traget host, before that create the directory with root user only
target host#mkdir /.ssh/authorized_keys and source host as well
Once create copy that generated the SSH-KEYGEN ed_rsa.pub file to authorised_keys.
#cat id_rsa.pub >> authorized_keys
#scp authorized_keys root@targethost:/root/.ssh
try to connect from source to target host without password, if its fine, then copy same source to which server you want connect without password.
Your comments are appreciated