Back

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

If you have lost the root password of your server, and you cannot access the server as root, then this article will help you resolve this issue.

To do this, you must access the server console. The server console can be accessed via the customer panel portal.servers.com.

The password reset algorithm is quite simple:

  1. Restart the server

  2. Before starting the OS, boot parameters will change in the GRUB boot menu

  3. OS will be loaded in the single-user mode

  4. Set the new root password without the old password requested

Let us examine in detail how reset the password for Ubuntu 16.04.

If the server is turned on and loaded, restart it by pressing CTRL + ALT + DEL. If not, turn on the server. After the BIOS menu, before the OS starts, a timer appears. To stop it and access the GRUB boot menu, press any key, preferably ESC.

Command line interface showing filesystem checks and password update

To start the system in a single-user mode, it is necessary to edit the boot line. To do this, use the keys ↓ and ↑to navigate through the menu, select your boot line (often it is "* Ubuntu"), and press the "e" key to access the boot mode editing options.

GRUB bootloader editor with Ubuntu boot parameters

Find the line that starts with "linux /boot ". At the end of the line, change the "ro" parameter to "rw", add the parameter "init=/bin/bash" after a space. Now everything is ready to start the system in the single-user mode. Press "CTRL+X" or "F10" to start the system.

GRUB bootloader configuration screen with command lines

As a result, you get a console where you should run the command:

passwd root

Enter the new root password twice.

Terminal screen with Linux boot process and file system check
Command line interface showing filesystem checks and password update

The root password is now changed. Save the changes and restart.

sync
reboot –f

Share

Suggested Articles

  • Linux administration

    How to reset root password on Ubuntu 16.04 Cloud Server

  • Linux administration

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