Root Access With SSH - PermitRootLogin or PasswordAuthentication


I just did a one click install of MongoDB. I’m SSH into the machine and its all ok.

Now, I want to disable password to the machine to prevent brute force, however two different articles are stating two different things to achieve this:

Is it:

PasswordAuthentication no 


PermitRootLogin without-password

The later, I can’t actually see this in my /etc/ssh/sshd_config file.

Also by doing this I presume if I access the console via the Digital Ocean page, I can still use the password to login?

If not, then what would happen the certs on my machine went missing?


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.


From a security standpoint, disabling root login and creating a sudo user is recommended – it’s what many would refer to as a best practice. Please don’t say it’s not important as that’s a misconception. When a sudo user is perfectly capable of handling root level commands and, unlike root, is not a well known and highly targeted user, there’s no excuse to allow root logins.


When it comes to security and preventing potential attacks, it’s best to simply create a sudo user and disable root login. The root user is well-known and will be the first one targeted by an attacker. When it comes to automated attacks, when root login is disabled, the login attempts will simply fail.

If you want to take things one step further, I would recommend that your sudo user not be a common user that is given ownership over any specific directories or files. When it comes to ownership of web-facing files and directories, you should create a user that has standard limited permissions.


Setting PasswordAuthentication to no enforces the use of SSH Keys for user accounts instead of plain-text passwords.

Disabling password authentication is far more secure and a much better option, though it does mean that you will have to keep up with your SSH Keys locally, otherwise you won’t be able to log in.

Console in DigitalOcean is unaffected since it doesn’t use SSH.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel