Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Not able to Setup passwordless ssh for ambari installation.

Solved Go to solution
Highlighted

Not able to Setup passwordless ssh for ambari installation.

Explorer

Hello,

I want to do a passwordless ssh login to my localhost.

I tried the following steps many times but it asks for password when i try "ssh localhost".

1. ssh-keygen

2. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

3. chmod 700 ~/.ssh

4. chmod 600 ~/.ssh/authorized_keys

This is screenshot of my terminal.

Screenshot from 2020-04-22 11-47-50.png

I tried the same steps to login from localhost to udhav.fqdn.com, but even now it promts me for password. 

For the second case i followed steps provided in this link.

https://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/

I guess i am doing small mistake. Can anyone help me with this?

Thank you.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Not able to Setup passwordless ssh for ambari installation.

@Udhav You need to set the hostname to the fqdn (not localhost), map the hostname in /etc/hosts/, generate the ssh-keys, add keys to authorized_keys, and login.   Thats it.

 

 

Here is full output of the above steps.  Please note the vagrant vm I use already has ssh setup, but I did it again (you will notice 2 keys in authorized_keys).

[root@c7401 ~]# hostname c7401.ambari.apache.org

[root@c7401 ~]# hostname -f

c7401.ambari.apache.org

[root@c7401 ~]# cat /etc/hosts | grep c7401
192.168.74.101 c7401.ambari.apache.org c7401

[root@c7401 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.

[root@c7401 ~]# cat ~/.ssh/id_rsa.pub 

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbUBYPL9JcoThQ5HWjZLpaHPEd3UlQaPcxzs1p08+pmWc6Q8JT+SGJ4G9087sDMnO1HsutzaoRchlTVN8AN1p7bg9mSnUVGYBSfrmz9dNiYujBCmEnymEB2qn30u3YncFE8um+fQRafrkcMTGwTfclB1CU9mP4FZEIW0+fWBqHBnR3mmkaVUAUgVATLTKIw8dMngDTRG9zVS6HVEpMPQYXl6mK5Oq0XLq31AZpYb7Fia4plw2mK7wQLUxxc0dSa7NQ3bzvr+lO3LRzEaAVvk4ZlqXddX23Z8PpsX7ZhS8lnQn4sojH82+BndVUO9N8VzS3LxzSAjmAThEDC47eXQyV root@c7401.ambari.apache.org


[root@c7401 ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[root@c7401 ~]# cat ~/.ssh/authorized_keys

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbUBYPL9JcoThQ5HWjZLpaHPEd3UlQaPcxzs1p08+pmWc6Q8JT+SGJ4G9087sDMnO1HsutzaoRchlTVN8AN1p7bg9mSnUVGYBSfrmz9dNiYujBCmEnymEB2qn30u3YncFE8um+fQRafrkcMTGwTfclB1CU9mP4FZEIW0+fWBqHBnR3mmkaVUAUgVATLTKIw8dMngDTRG9zVS6HVEpMPQYXl6mK5Oq0XLq31AZpYb7Fia4plw2mK7wQLUxxc0dSa7NQ3bzvr+lO3LRzEaAVvk4ZlqXddX23Z8PpsX7ZhS8lnQn4sojH82+BndVUO9N8VzS3LxzSAjmAThEDC47eXQyV root@c7401.ambari.apache.org

[root@c7401 ~]# ssh root@c7401.ambari.apache.org
The authenticity of host 'c7401.ambari.apache.org (192.168.74.101)' can't be established
ECDSA key fingerprint is SHA256:mjGym7gkqWjPvW2JXhKjqWl4XC6wuhgNIukldSVtkFk.
ECDSA key fingerprint is MD5:b7:d4:73:92:03:69:ae:63:af:69:19:96:51:2b:bc:de.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'c7401.ambari.apache.org,192.168.74.101' (ECDSA) to the list of known hosts.
Last login: Wed Apr 22 11:21:57 2020

 

 

 

 

 


 


If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  


 


Thanks,



Steven

View solution in original post

4 REPLIES 4
Highlighted

Re: Not able to Setup passwordless ssh for ambari installation.

@Udhav You need to set the hostname to the fqdn (not localhost), map the hostname in /etc/hosts/, generate the ssh-keys, add keys to authorized_keys, and login.   Thats it.

 

 

Here is full output of the above steps.  Please note the vagrant vm I use already has ssh setup, but I did it again (you will notice 2 keys in authorized_keys).

[root@c7401 ~]# hostname c7401.ambari.apache.org

[root@c7401 ~]# hostname -f

c7401.ambari.apache.org

[root@c7401 ~]# cat /etc/hosts | grep c7401
192.168.74.101 c7401.ambari.apache.org c7401

[root@c7401 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.

[root@c7401 ~]# cat ~/.ssh/id_rsa.pub 

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbUBYPL9JcoThQ5HWjZLpaHPEd3UlQaPcxzs1p08+pmWc6Q8JT+SGJ4G9087sDMnO1HsutzaoRchlTVN8AN1p7bg9mSnUVGYBSfrmz9dNiYujBCmEnymEB2qn30u3YncFE8um+fQRafrkcMTGwTfclB1CU9mP4FZEIW0+fWBqHBnR3mmkaVUAUgVATLTKIw8dMngDTRG9zVS6HVEpMPQYXl6mK5Oq0XLq31AZpYb7Fia4plw2mK7wQLUxxc0dSa7NQ3bzvr+lO3LRzEaAVvk4ZlqXddX23Z8PpsX7ZhS8lnQn4sojH82+BndVUO9N8VzS3LxzSAjmAThEDC47eXQyV root@c7401.ambari.apache.org


[root@c7401 ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[root@c7401 ~]# cat ~/.ssh/authorized_keys

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbUBYPL9JcoThQ5HWjZLpaHPEd3UlQaPcxzs1p08+pmWc6Q8JT+SGJ4G9087sDMnO1HsutzaoRchlTVN8AN1p7bg9mSnUVGYBSfrmz9dNiYujBCmEnymEB2qn30u3YncFE8um+fQRafrkcMTGwTfclB1CU9mP4FZEIW0+fWBqHBnR3mmkaVUAUgVATLTKIw8dMngDTRG9zVS6HVEpMPQYXl6mK5Oq0XLq31AZpYb7Fia4plw2mK7wQLUxxc0dSa7NQ3bzvr+lO3LRzEaAVvk4ZlqXddX23Z8PpsX7ZhS8lnQn4sojH82+BndVUO9N8VzS3LxzSAjmAThEDC47eXQyV root@c7401.ambari.apache.org

[root@c7401 ~]# ssh root@c7401.ambari.apache.org
The authenticity of host 'c7401.ambari.apache.org (192.168.74.101)' can't be established
ECDSA key fingerprint is SHA256:mjGym7gkqWjPvW2JXhKjqWl4XC6wuhgNIukldSVtkFk.
ECDSA key fingerprint is MD5:b7:d4:73:92:03:69:ae:63:af:69:19:96:51:2b:bc:de.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'c7401.ambari.apache.org,192.168.74.101' (ECDSA) to the list of known hosts.
Last login: Wed Apr 22 11:21:57 2020

 

 

 

 

 


 


If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  


 


Thanks,



Steven

View solution in original post

Highlighted

Re: Not able to Setup passwordless ssh for ambari installation.

Explorer

@stevenmatison after this will i be able to use the hostname as a target host while creating a cluster in ambari?

And also i am using ubuntu 18.04.

Thank you

Re: Not able to Setup passwordless ssh for ambari installation.

@Udhav  Yes.  Once you complete the rest of the node readiness (install repos, ambari-server, ambari-agent) you would visit http://[fqdn]:8080 and begin rest of cluster install via Ambari.

 


 


If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  


 


Thanks,



Steven

Highlighted

Re: Not able to Setup passwordless ssh for ambari installation.

Explorer

@stevenmatison Thank you very much!

Don't have an account?
Coming from Hortonworks? Activate your account here