> For the complete documentation index, see [llms.txt](https://docs.glesys.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glesys.com/products/compute/guides-for-server-management/reset-your-password-in-linux.md).

# Reset your password in Linux

***

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](/products/compute/kvm-virtual-machines/how-tos/connect-to-the-vm-console.md) from the VM's **Actions** menu. Or, if it's a dedicated server, open the [IPMI console](/products/bare-metal/dedicated-servers/how-tos/connect-to-the-server-using-ipmi.md#console-access-html5).

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 <kbd>e</kbd> 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`.

<figure><img src="/files/BQaA4339XH7MhfvXDmSB" alt=""><figcaption></figcaption></figure>

After adding the text, press <kbd>Ctrl-x</kbd> 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:

{% code title="Command" %}

```terminal
mount / -rw -o remount
```

{% endcode %}

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

{% code title="Command" %}

```terminal
passwd glesys
```

{% endcode %}

Type the new password at the prompts:

{% code title="Passwd command prompts" %}

```terminal
New password:
Retype new password:
passwd: password updated successfully
```

{% endcode %}

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

{% code title="Command" %}

```terminal
sync
```

{% endcode %}

{% hint style="warning" %}
If the server is running **AlmaLinux** or **Fedora**, you need to execute the following command now, before booting the server normally:

```
touch /.autorelabel
```

{% endhint %}

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

{% code title="Command" %}

```
exec /sbin/init
```

{% endcode %}

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