How to reset root password on Ubuntu 16.04 Cloud Server

If you have lost the root password of your server, you can restart the server in single-user mode and set a new password. To do this, you must access the server console via the customer portal

Open the server's page in "Cloud Servers > Create & Manage" section of the customer portal. Make sure the server is active.

Open the server's VNC Console using the button of the same name:

Virtual machine information panel on with VNC console option

Restart the server using "Send CtrlAltDel" button in the VNC Console window.

After the BIOS screen, before the OS starts, a "Booting from Hard Disk..." line appears. Press ESC at the very same moment to open the GRUB menu.

SeaBIOS boot screen initiating iPXE network boot process
GRUB bootloader with Ubuntu selected for booting

Press 'e' to edit the boot menu. Changes will persist until next boot.

Scroll down to the line that starts with "linux /boot ". Remove the parameters highlighted in green on the picture below:

GRUB bootloader screen with kernel boot parameters highlighted

Change the "ro" parameter to "rw", add the parameter "init=/bin/bash" after a space. The parameters string should look like on the following picture:

GNU GRUB bootloader configuration interface on a terminal

Press Ctrl + X to boot into single-user mode using modified parameters. You may need to press Enter for the command prompt to appear after boot.

Terminal display of system boot process and hardware detection

After the boot process complete, use the following command to set a new root password:

passwd root

Restart the server with reboot command:



Suggested Articles

  • Linux administration

    How to reset the root password on Ubuntu 16.04 on a dedicated server

  • Linux administration

    How to reset the root password on CentOS 6 and CentOS 7