For the complete documentation index, see llms.txt. This page is also available as Markdown.

Reset your password in Linux

If you forget your password to your Linux server, you can easily reset it by booting your server into single-user mode.


To reset your password, you first need to restart your server to single-user mode.

First, make sure you have a console open. If it's a virtual machine, open a console from the VM's Actions menu. Or, if it's a dedicated server, open the IPMI console.

Then restart your server by clicking Reboot in the Actions menu if it's a virtual machine, or by using IPMI if it's a dedicated server (Power Control → Software shutdown, and then Power Control → Set power on).

As soon as the menu with the Linux kernels appears in Grub, press e on the keyboard.

This opens an editor. Here, add init=/bin/bash at the end of the line that contains something like linux /boot/vmlinuz and ro.

After adding the text, press Ctrl-x to boot the server. You will then be logged in as root in single-user mode without a password.

The disk is currently mounted in read-only mode. You need to start by remounting the disk in read-write mode to make changes. This is done using the following command:

You can now change a user's password. Here, we change the password for the user glesys using the passwd command:

Type the new password at the prompts:

Finally, to be on the safe side, execute the sync command to make sure the changes have been written to disk:

Finish by booting the server normally by executing the following command:

The server will now boot into multi-user mode, and you can log in to the console using the password you just set.

Last updated

Was this helpful?