I use SSH to communicate with my Raspberry Pi (server) from my laptop (Putty client). I would like to disable root SSH login. I change the value of "PermitRootLogin" to no in the /etc/ssh/sshd_config. I restart ssh service via the cmd "sudo service ssh restart"

But, on Putty, I can always login with root password.

How can I disable root ssh login ?

Thx !

  • This is strange-the Pi doesn't have a root password
    – Milliways
    Commented Jun 15, 2018 at 21:48
  • Does this persists after a system restart? Are you sure you didn't make a typo or edited the wrong file? Does "I can always login with root password" means you can login as root? Commented Jun 25, 2018 at 9:21

1 Answer 1


You can allow or deny specific users in /etc/ssh/sshd_config by setting

# whitelist
AllowUsers pierrot arlecchino

# blacklist
DenyUsers innamorati pantalone

and then run sudo systemctl restart ssh. Be advised: Before you deny users, especially the default user "pi", make sure you can login by SSH with the allowed user, else you risk to lock out yourself!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.