Ubuntu – Permission denied please try again ssh error

serversshusers

I had a root access to my server and I was logged in through ssh. I I did this in my

AllowUsers john

/etc/ssh/sshd_config

in this file.

Now after this I rebooted the server. now I am unable to login through root user and unable to login through john as well. nothing is working. Please help?

my root user was this e.g root@ip

If I try to login ssh root@ip through root it says this

Permission denied, please try again.

If I try to login with john it says

Shell access is not enabled on your account!
If you need shell access please contact support.

I don't understand why I am unable to login through my root account.

Note: I can successfully login through in WHM

Best Answer

Also note: the AllowUsers specifies that login is allowed only for those user names that match a pattern listed with this keyword. By default, login is allowed for all user names. So, with your configuration, john is the only user that can log in using ssh.

The answer from Sebastian Stark is also correct: root would not be able to login by default, even if you had included root in AllowUsers.

So: I recommend, first, making sure that user john can login correctly. Make sure that john has a shell assigned in /etc/passwd and give him one using chsh if necessary. Then, login as john and use sudo if you need root access.

Related Question