Report this

What is the reason for this report?

Disabling root login on Ubuntu 20.04 WP image: no "PermitRootLogin" line in /etc/ssh/sshd_config

Posted on February 24, 2022

I’ve set up a new server using the Wordpress Ubuntu 20.04 image.

Previously with my servers I have always disabled root login for security reasons.

To do this it seems like you need to go to /etc/ssh/sshd_config and change “PermitRootLogin” from “prohibit-password” to “no”. But this line does not exist, and adding it does not stop me logging in as root, after running systemctl restart sshd.

I use SSH and don’t log into root with a password. Is it still recommended to set up another sudo user and disable root? If so, how do I do this?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

It sounds like that you might have been editing the /etc/ssh/ssh_config file rather than the sshd_config.

I’ve just checked on a new server and I can confirm that the PermitRootLogin option is present.

On your second question, yes having a sudo user is still recommended rather than using root directly.

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.