How to allow password authentication for non-root users? (Root still pubkey only)

I’m wondering if it’s possible to do as mentioned in title.

I want root to still not allow password, but a user is allowed to do so.

The reason is because I need to setup Github Action auto-deployment using and the script is bugged to only allow SSH password.


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, @hrsetyono

What you can do is to tweak the ssh config file and allow only PubKey authentication for the root username and have the PasswordAuthentication for the other users enabled.

You can use Match in the sshd_config

PasswordAuthentication no
Match User root
PasswordAuthentication yes
Match all

and then restart the ssh daemon.

Hope that this helps!

Regards, Alex

So I’m thinking of a hacky solution. After changing the PasswordAuthentication to yes, what if I simply do not set the root password?

That way nobody know the password and my root is still basically secured to PubKey only.

But is there such thing as default root password? If there is, how strong is it?