Please login as the user centos rather than the user root Error Fix

Please login as the user centos rather than the user root

I have lately been experimenting with AWS (Amazon web services) and the idea of setting up your server yourself is just too overwhelming for me.It’s super-cool to create your own instances, volumes and iptables. If you haven’t tried it so far, try it. Documentation is very explicit and clear that you can manage almost all of the stuff yourself. Anyway, I created an instance with Centos 6.7.

The connection string I got looked like this:

ssh -i "cdh-sample.pem" root@ec2-35-162-129-101.us-west-2.compute.amazonaws.com

Here’s a snapshot:

SSH_access_into_AWS_Centos_machine

SSH_access_into_AWS_Centos_machine

I tried to ssh into the instance and got this error message

Please login as the user “centos” rather than the user “root”

Here’s the snapshot for the error message:

Please login as the user centos rather than the user root

How to fix Please login as the user "centos" rather than the user "root"? Here’s a problem fix:

1. Replace root with centos in the connection string.

For example: My connection string would look like this now:

ssh -i "cdh-sample.pem" centos@ec2-35-162-129-101.us-west-2.compute.amazonaws.com

2. Switch to root user

sudo -s

3. Open the file using vi editor:

sudo vi /root/.ssh/authorized_keys

4. Start editing it :

Remove all of the content before

ssh-rsa

and save the file.

5. Edit the next file using command :

sudo vi /etc/ssh/sshd_config

6. Un-comment the line by removing # before it.

PermitRootLogin yes

7. Restart sshd service using the command :

sudo service sshd restart

OR

systemctl restart sshd

That’s it. ๐Ÿ™‚

Try logging in using the original ssh command with root user and it should TADA, It should work now!

I was trying to install services to a new host using cloudera and that’s when I encountered this error. I hope it solves your problem too and the instance should allow/permit the root login.

P.S: Internet is a successfully thriving community from generous contributions of people from across the globe. You can help it thrive too. Please contribute. As a reader, you can be contributing with your valuable feedback.
Please drop by a comment or Share to let people know you were here. ๐Ÿ™‚ ๐Ÿ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *