I am unable to connect to ssh despite the fact that PermitRootLogin option is set to "yes" in my sshd_config.

ssh localhost
root@localhost's password: 
Permission denied, please try again.

Here is my full sshd_config:

PasswordAuthentication yes
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem   sftp    /usr/lib/openssh/sftp-server
PermitRootLogin yes
AllowUsers otheruser

What prevent the ssh connection as root and how to fix it?

  • 2
    Note: Password authentication, and allow root, are both asking to be hacked. If this machine is visible on the internet, then don't do it. Use a public/private key, and use sudo. Jun 9, 2018 at 10:45

1 Answer 1



If specified, login is allowed only for user named that match one of the patterns.

Add root to the list:

AllowUsers root otheruser

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .