# Password change via Rescue

Have you forgotten the password for your dedicated Linux server? There's nothing wrong with that, let's solve this problem.

First of all, we need to put our dedicated server into recovery mode (Rescue). This can be done using [instructions.](https://wiki.spacecore.pro/en/hetzner/control-panel-lk)

<figure><img src="https://287241268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyXvdNIxNLIOcexv7AfU2%2Fuploads%2Fgn2H1luz9tmKx7sfleFp%2Fimage.png?alt=media&#x26;token=b7f993a5-02be-4f50-b3f2-ba2a676679ff" alt=""><figcaption></figcaption></figure>

We use the `lsblk` command to view the existing drives on our server.

If you are using **Software** **RAID** on your server, the output will be something like this. Pay attention to the md sections, namely md0, **md1, md2**

<figure><img src="https://287241268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyXvdNIxNLIOcexv7AfU2%2Fuploads%2FI3cNiB967Y6BnlDuIBGJ%2Fimage.png?alt=media&#x26;token=14db0c22-691e-49eb-aa0e-2422a26fd3f2" alt=""><figcaption></figcaption></figure>

If Software RAID is not used on your server, then depending on the types of drives, the output of the command will look something like this:

<figure><img src="https://287241268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyXvdNIxNLIOcexv7AfU2%2Fuploads%2FCxdloxqKZmV1FYS6ONnw%2Fimage.png?alt=media&#x26;token=b126df16-f78e-4ba3-ae15-193b3642435f" alt=""><figcaption></figcaption></figure>

Next, you need to mount the partition of the main disk. Since Software RAID is used on our test server, **md2** is suitable in this case.

```
mount /dev/md2 /mnt
```

Great!

<figure><img src="https://287241268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyXvdNIxNLIOcexv7AfU2%2Fuploads%2FIsaFWzsfHxi3n3oGla63%2Fimage.png?alt=media&#x26;token=cbe7fcf2-9a80-463b-b96c-dfa8c24b1452" alt=""><figcaption></figcaption></figure>

Now we specify a new root directory to work on the newly mounted drive:

```
chroot /mnt /bin/bash
```

The main process is completed. Now all we have to do is use the standard command to change the password of the corresponding user.

```
passwd root
```

We enter the new password twice.

<figure><img src="https://287241268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyXvdNIxNLIOcexv7AfU2%2Fuploads%2FOpxXpWF2lcEVgfzBrg0g%2Fimage.png?alt=media&#x26;token=3e091485-db3f-4789-85e8-702c8a8d3d10" alt=""><figcaption></figcaption></figure>

Done.\


<figure><img src="https://287241268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyXvdNIxNLIOcexv7AfU2%2Fuploads%2FhI55vJAfseKHM3CG4mwJ%2Fimage.png?alt=media&#x26;token=442233f6-f94b-4082-b8f2-ad3156852566" alt=""><figcaption></figcaption></figure>

It simply remains to restart the server in the cloud panel or with the `reboot` command to exit **Rescue** mode. After that, we can connect to our server using the new specified password.

If you get a similar error when using the `reboot` command, then you need to use the `CTRL + D` keyboard shortcut to exit the additional created session.

<figure><img src="https://287241268-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyXvdNIxNLIOcexv7AfU2%2Fuploads%2FdXrQZfDeLoKIrPW4HNVn%2Fimage.png?alt=media&#x26;token=66ee6742-2bce-47a7-8b73-f50340b89943" alt=""><figcaption></figcaption></figure>

Great. Now we can restart our server and start further work!
