Question

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

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?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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