I have a running hortonworks sandbox and I am trying to add a new host (ubuntu) to it. I have assigned ip addresses to each of the machines and I am also able to ssh into both the sandbox and the ubuntu machine remotely. I have also added the public key of sandbox to my host using https://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/. So I am also able to login to my host (ubuntu) from the sandbox without any password. However, when I try to add the host using the ambari UI, I get an error.
========================== Creating target directory... ========================== Command start time 2018-09-13 21:45:39 Permission denied (publickey,password). SSH command execution finished host=10.99.162.xxx, exitcode=255 Command end time 2018-09-13 21:45:40 ERROR: Bootstrap of host 10.99.162.xxx fails because previous action finished with non-zero exit code (255) ERROR MESSAGE: Permission denied (publickey,password). STDOUT: Permission denied (publickey,password).
Sandbox is basically designed for quick testing and learning the HDP/HDF components. It is basically designed to be a Single Node Cluster installation. So is there any specific reason that you are trying to add more hosts to your Sandbox?
Also the error which you shared seems to bre due to SSH keys setup.
ERROR: Bootstrap of host 10.99.162.xxx fails because previous action finished with non-zero exit code (255) ERROR MESSAGE: Permission denied (publickey,password).
Note that the Sandbox are customized containers which runs on Docker so there are different ports used for some services like port 2222 for doing the SSH ..etc.
In general if you want to fix the "Permission denied (publickey,password)" error then you might need to kee the following things in mind.
1. The correct SSH port is being used. (by default in the abari UI during host registration you will see the default SSH port as 22. Where as Sandbox uses port 2222)
2. You need to check the following directory and file permissions.
######## ls -l ~/.ssh/ total 16 -rw-------. 1 root root 412 Aug 18 2016 authorized_keys -rw-------. 1 root root 1675 Feb 13 2017 id_rsa -rw-r--r--. 1 root root 404 Feb 13 2017 id_rsa.pub -rw-r--r--. 1 root root 2821 Dec 4 2017 known_hosts ######## ls -ld ~/.ssh/ drwx------. 2 root root 4096 Feb 13 2017 /root/.ssh
3. The Hostname (FQDN) resolution should be correct. Ambari Cluster relies on the FQDN not directly on the IP Address) Every cluster node should be able to resolve each other using their correct FQDN (including Ambari Server)
# hostname -f # cat /etc/hosts
Please use the Hostnames to do ssh or to register a host instead of using the IP Addresses (host=10.99.162.xxx)
1. I think the correct ssh port is being used while registering the hosts as I am able to ssh to my host from the sandbox using port 22.
2. On my sandbox:
ls -l ~/.ssh/
-rw-r--r-- 1 root root410 Sep 13 22:55 authorized_keys
-rw------- 1 root root 1675 Sep 13 22:48 id_rsa
-rw-r--r-- 1 root root410 Sep 13 22:48 id_rsa.pub
-rw-r--r-- 1 root root798 Sep 13 22:53 known_hosts
ls -ld ~/.ssh/
drwx------ 1 root root 4096 Sep 13 22:55 /root/.ssh/
3. On sandbox:
::1 localhost ip6-localhost ip6-loopback
On the host:
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
Also I am able to ssh to my ubuntu machine using hostname (sahil-virtual-machine) however I am unable to ssh to the sandbox using the hostname (sandbox.hortonworks.com)
This is just for learning purposes as I am new to all this. Your help is very much appreciated.