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,
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.
Click below to sign up and get $100 of credit to try our products over 60 days!
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_config
PasswordAuthentication
from “no” to “yes” and save the filesudo nano ~/.ssh/authorized_keys
sudo nano /etc/ssh/sshd_config
PasswordAuthentication
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
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:
To disable the root user completely, have your /etc/ssh/sshd_config file have this line in it:
Remember to have these changes take effect, you need to restart your SSH service.
Hope it helps, Jason Colyer DigitalOcean Platform Support Lead