Root Password for VPS created with Predefined SSH Keys

Posted October 11, 2016 6.7k views
Getting StartedSecurityDigitalOceanUbuntu 16.04

A DO article states:

When you create a new VPS, you can choose to include that public key on the server. No root password will be emailed to you and you can log in to your new virtual private server from your chosen client. If you created a passphrase, you will be prompted to enter that upon login. (–2)

The problem is the DO Droplet Console requires a root password.

  1. How do you get the root password?
  2. Other available work arounds?

thank you

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.

Submit an Answer
3 answers

Here are the steps taken to resolve this issue based on ryanpq’s response.

  1. Update your SSH to not require a password. This will require the following file be edited: /etc/ssh/sshd_config The parameter for PasswordAuthentication should be commented out and set to yes. This will need to be uncommented and changed to no.

Should read:

#PasswordAuthentication yes

Change to:

PasswordAuthentication no

After saving changes, restart ssh

service ssh restart
  1. Now add a password to the root userid. Enter the following command: passwd The command will prompt you for the new password and a duplicate new password to validate.

Now you can access the console from the droplet menu and have passwordless access via SSH.

With a droplet using ssh-keys you will need to log in via ssh with your key the first time. You can then run passwd to set a password for the root user. As long as your ssh configuration doesn’t allow for password authentication you can use the password you created to access the console (your droplet sees this as a local keyboard and display) but not to create a remote ssh connection.

Edit - follow this only if you can’t access SSH, if you can SSH follow @ryanpq answer

As you said when you create Droplet with public key included, root password will not be emailed. Without root password you can’t login into console.
There is one workaround:

Go to DO Control Panel. Select your Droplet.
From right menu select Access option.
On that page you will have Reset root password button. Click on it, it will power off your Droplet and root password will be emailed to you.

With that password you can use console to login with
username: root
password: emailed one

Warning: it will power off your Droplet before resetting root password, so some downtime will occur. Process usually lasts only few seconds