> 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.glesys.com/products/compute/guides-for-server-management/reset-your-password-in-linux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
