I ran into a similar issue when setting up a hadoop cluster on Amazon ec2.
My head node should have root ssh access to every worker / slave node. I connected the connections by adding an IP address, a private address, and an alias to /etc/hosts/ each subordinate node. (I get this data by running the command echo -e "`hostname -i`\t`hostname -f`\talias-name" , where alias-name is what I call each node ( head or n1 for example). Then I put this output for each node in each node /etc/hosts .
The problem that I am facing is that when I type ssh n1, being in my head node, in ssh in my first sub node, I get the same error message: Please login as the use "ec2-user" rather than the user "root". Therefore, after some research, I figured out how to fix it.
At first:
- ssh to your server. non-root access (ec2-user) is great here.
- Then
su - your root path. Now vi /etc/ssh/sshd_config and un-comment line is PermitRootLogin yes . - Quit vi.
- Now restart the ssh daemon by typing
service sshd stop , then service sshd start .
Second:
- Now, here is the part that I had to dig,
- run
vi /root/.ssh/authorized_keys - Comment everything up to
ssh-rsa. Just put # at the beginning of the contents of the file, before no-port-forwarding ... and press enter on ssh-rsa to move it to the next line (this way you don't have to delete anything if you want to backtrack). - exit vi editor
Now you can log in to root without an error message.
Also, if you use aliases to configure the cluster; Repeat the same steps for each node. First ssh to use the ec2 user, follow these steps. After adding the IP address, private address, and alias information to the /etc/hosts you can use ssh for each root root using the alias name, for example ssh n1 .
The following tutorial is here: https://www.youtube.com/watch?v=xrxQXfE7t9A
But he did not discuss the root entry issue.
Hope this helps! It worked for me.
* Keep in mind that I was not worried about security. This is just a practice / dev setup.
brno792 Aug 04 2018-12-21T00: 00Z
source share