Question
(Bug) Create droplet with SSH then disable SSH for root
I found a bug when I followed the first steps to creating a securing the server.
The problem :
You don’t know the password for root when creating a droplet with an ssh key
Reproduce the problem :
- Create a droplet with an ssh key
- Connect to server with ssh key
- Create a new user and add ssh connection
- Disable ssh for root (security measure)
- Try to do
sudo
with the new user
You’re asked to enter a password for root
but DigitalOcean didn’t send the password by email because I created the droplet with an ssh key.
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.
×
Weird since it should ask password of the new user.. Is that username on sudoer list?
Yes I added the new user to
sudo
group, but without a password.I created a
.ssh
folder on the home directory with aauthorized_keys
file containing my public keyI just noticed the option to reset root password from
Access
menu of the droplet.You have to exit your login session and re-login in in order to pick up the new sudo group membership permissions. (or use Userify, but that will only do the user creation part… disabling root is still recommended.)