Hi,
I know that the best way is to have ssh key authentication but the problem is that sometimes we lose the keys and then the only way is to have root access again to generate new keys etc. Is it possible to disable any root/user password login from remote but only allow it from the control panel?
Thanks,
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!
What you can do is have the root user only authenticate using SSH keys. Since the SSH settings do not impact the Web Console, you can even disable the root user and still be able to use the DigitalOcean Web Console to login to your droplet in case something were to happen to your keys.
To make it so only SSH keys authenticate, have your /etc/ssh/sshd_config file have this line in it:
PasswordAuthentication no
To disable the root user completely, have your /etc/ssh/sshd_config file have this line in it:
PermitRootLogin no
Remember to have these changes take effect, you need to restart your SSH service.
Hope it helps, Jason Colyer DigitalOcean Platform Support Lead
Hello all,
You can always use the DigitalOcean console as per Jason’s reply. If you happen to lose your ssh-keys you can use the console in order to temporary enable the root user and enable PasswordAuthentication in order to use an ssh-client and upload your new ssh-key.
You can enable PasswordAuthentication for your Droplet by modifying your /etc/ssh/sshd_config file. Once set to Yes restart the SSH service and connect via an SSH client for a more stable connection. You can then modify your ~/.ssh/authorized_keys file to add the appropriate public key.
This change can be made from DigitalOcean’s console. If you’re having issues accessing the console you can then reach to our amazing support team that can help you further with this.
To enable the PasswordAuthentication follow these steps:
sudo nano /etc/ssh/sshd_configPasswordAuthentication from “no” to “yes” and save the filesudo nano ~/.ssh/authorized_keyssudo nano /etc/ssh/sshd_configPasswordAuthentication from “yes” to “no” and save the fileYou can then upload the key using this command:
ssh-copy-id -i ~/.ssh/mykey user@droplet
Hope that this helps! Regards, Alex
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.