Support Questions
Find answers, ask questions, and share your expertise

ambari-server Regarding SSH

ambari-server Regarding SSH


I was created SSH and stored in the /.ssh/id_rsa location and also copied the to child node. used chmod 700 for .ssh and chmod 600 for /.ssa/

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.




Re: ambari-server Regarding SSH

From "node1" host where you created the "" file you will need to push it to other hosts where you want to do passwordless ssh.

[root@node1 ~]# ssh-copy-id   -i ~/.ssh/

[root@node1 ~]# ssh-copy-id   -i ~/.ssh/

[root@node1 ~]# ssh-copy-id   -i ~/.ssh/

Re: ambari-server Regarding SSH

Else as another alternative you will need to copy the contents of file "~/.ssh/" 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 "" from node1 to this file "~/.ssh/authorized_keys" of all hosts:

Re: ambari-server Regarding SSH

Super Collaborator

Hi @narender pasunooti:

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 in /home/user/.ssh/)wiht 600 permsssion.

Now you can able to do ssh server2 from server1 without enter the password

for reference:

Re: ambari-server Regarding SSH

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 "echo `cat ~/.ssh/` >> /root/.ssh/authorized_keys"

ssh "echo `cat ~/.ssh/` >> /root/.ssh/authorized_keys"

ssh "echo `cat ~/.ssh/` >> /root/.ssh/authorized_keys"

Re: ambari-server Regarding SSH

Expert Contributor

Follow below steps it worked for me.

1) Generate the ssh-key from "root" user

$sudo su - root


it will create "" 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 "" 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 file to authorised_keys.

#cd .ssh

#cat >> 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