loader
image/svg+xml
  • Data centers and network
  • Products and services
  • Industries
  • Support
  • News
  • About us

Knowledge Base

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:

1Restart the server
2Before starting the OS, boot parameters will change in the GRUB boot menu
3OS will be loaded in the single-user mode
4Set 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.

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.

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.

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

passwd root

Enter the new root password twice.

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

sync
reboot –f