---
title: "Reset the Server root Password in the Operating System | Hostman Docs"
description: "Reset your server root password via SSH with our secure step-by-step recovery guide."
---

> For the complete documentation index for AI agents, see [llms.txt](https://hostman.com/llms.txt).

The easiest way to reset the root user password is [through the Hostman dashboard](https://hostman.com/docs/cloud-servers/root-password-reset/). This method works even if the old password is lost, as you do not need to enter it.

However, you can also reset the password directly in the operating system, using the guide below.

> [!NOTE]
> Note that If you change the password via SSH, the root password you can copy in the dashboard will no longer work.

## If You Know the root Password

If you know the current password for the root user, you can change it as follows.

1.  Connect to the server via SSH as `root` using the current password.
2.  Execute the command:

```shell
passwd
```

3.  The system will ask for the new password twice. Enter it.

Done, the password is changed. You can now log in as `root` using the new password.

## If the root Password is Unknown

If you don't know the current root password, you can reset it and set a new one by booting the server from the recovery disk.

1.  Boot the system [from the recovery disk](https://hostman.com/docs/cloud-servers/boot-mode/).
2.  In the **Console** in the dashboard.
3.  Mount the `root` partition. Its name may vary: `sda1` or `vda1`. First, try:

```shell
mount -o rw /dev/sda1 /mnt
```

If you receive the error:

```shell
mount: /mnt: fsconfig system call failed: /dev/sda1: Can't lookup blockdev.
```

run:

```shell
mount -o rw /dev/vda1 /mnt
```

Then execute:

```shell
chroot /mnt /bin/bash
passwd root
```

4.  The system will ask for the new `root` password twice. Enter it.

If the password is changed successfully, you will see a confirmation message, such as: `passwd: all authentication tokens updated successfully` or `password updated successfully`.

5.  Press CTRL + D to exit `chroot`.
6.  Unmount the disk with the command:

```shell
umount /mnt
```

6.  Remount the root file system in read-only mode, using vda1 or sda1, depending on what worked in the Step 3:

```shell
mount -o ro /dev/sda1 /mnt
```

7.  Reboot the server [in standard mode](https://hostman.com/docs/cloud-servers/boot-mode/) via the dashboard.

Now you will be able to connect to the server as `root` using the new password.
