Report this

What is the reason for this report?

prevent firewall ssh lock out

Posted on August 4, 2025

To secure my droplets, for ssh I usually replace text password with public key and change 22 to a non standard port. In adjusting my firewall settings I’ve managed to get locked out of my own account. The emergency recovery console has saved me. In order to prevent getting locked out, what does Digital Ocean require - port 22? Text passwords?

In a related question - /etc/ssh/sshd_config.d has two files: 50-cloud-init.conf 60-cloudimg-settings.conf regarding text passwords, one says yes, the other no. Can you explain this? TIA



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.

Heya, @enews

The recovery console does not use the SSH protocol, and you can always use it in case you get locked out because of firewall management.

You can use the DigitalOcean Cloud Firewall or UFW to allow only certain IPs on the SSH Port.

You can verify what’s active by running:

sshd -T | grep passwordauthentication

This will show you what the final active value is after the includes are applied.

Hope that this helps!

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.