Methods of payment Abuse

How to change the password on the Ubuntu 16 operating system

28.04.2021, 20:04

You may have lost or simply forgotten the root password of the server. You will not be able to access the server as a superuser. If this is the case, this article will help you to quickly solve the problem. First of all, you need access to the server console.

Reset root password

The algorithm for resetting the root password is simple:

  1. Reboot the server.
  2. Change the kernel boot parameters in the GRUB boot loader menu before the operating system starts booting.
  3. Boot the operating system in single-user mode.
  4. Set a new root password without entering the old password.

Let's analyze each step.

Step-by-step instructions to reset password in Ubuntu 16

First, restart the server if it is powered on and booted by pressing CTRL + ALT + DEL. If the server is powered off, power it on. After the BIOS menu loads, but before the OS boot starts, a timer will appear on the screen. To stop the OS boot timer and enter the GRUB boot loader menu, press any key (except Enter).

To boot the system in single-user mode, you will need to edit the bootstrap. Use the up and down keys on your keyboard to navigate between boot menu lines. Highlight the line you want (usually "* Ubuntu") and press the "e" key to start editing the boot options.

Next you need to find the line that starts with linux /boot. Find the "ro" parameter at the end of that line and replace it with the rw parameter. After a space, add the new parameter:

init=/bin/bash

You have done everything necessary to start the system in single-user mode. Press CTRL+X or F10 and boot it.

This will then load the console where you will need to enter a command:

passwd root

You will then have to enter the new root password twice.

You have changed the root password. Now save the changes to disk and reboot the system:

sync
reboot