---
title: "Change and recover cloud server password"
sidebar_label: "Change and recover server password"
description: "How to change and recover a cloud server password in Rescue recovery and diagnostics mode"
sidebar_position: 3
toc_max_heading_level: 2
---

import Formbricks from '@theme/MDXComponents/Formbricks'
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import {TabItemLabel} from '@selectel/docux/components'

# Change and recover cloud server password

You can view the root user password in the [control panel](https://my.selectel.ru/vpc/default/servers/): from the top menu, click **Products** → **Cloud Servers** → server page → **Console** tab → **Password** field.

If you have forgotten or lost your password, you can [change it in the control panel](#change-password).

If authorization with the new password does not work or you have trouble changing it, [recover the password](#recover-password) via Rescue recovery and diagnostics mode.

## Change password \{#change-password}

1. In the [control panel](https://my.selectel.ru/vpc/default/images/), on the top menu, click **Products** and select **Cloud Servers**.
2. Open the server page → **Console** tab.
3. Click **Generate new**.

### Error when changing password \{#unable-to-set-password}

If an error `Unable to set password on instance` occurs during password generation, [perform a soft reboot of the cloud server](/cloud-servers/manage/reboot-server.mdx#perform-soft-reboot).

The error may occur due to the small size of the server disk. The disk memory is occupied by the log journal, which makes the required password change operations unavailable. After restarting the server, some logs are deleted and space becomes available on the disk.

## Recover password \{#recover-password}

<Tabs queryString="recover-password">
  <TabItem value="linux" default>
    <TabItemLabel>
      Linux
    </TabItemLabel>

    1. [Boot the server into Rescue recovery and diagnostics mode](/cloud-servers/troubleshooting/boot-to-rescue.mdx#boot-server-to-rescue).

    2. Connect to the cloud server in Rescue mode [via the console in the control panel](/cloud-servers/manage/connect-to-server.mdx#connect-through-console) or [via SSH](/cloud-servers/manage/connect-to-server.mdx#connect-via-ssh).

    3. Change the OS root directory:

       ```bash
       infiltrate-root
       ```

    4. Change the password for the root user:

       ```bash
       passwd root
       ```

    5. Enter the new password twice. The password will not be displayed in the command line.

    6. Wait for confirmation that the password has been changed:

       ```bash
       passwd: password updated successfully
       ```

    7. [Exit Rescue mode](/cloud-servers/troubleshooting/boot-to-rescue.mdx#exit-rescue-mode). The server will restart automatically.

    ### Error when changing directory \{#no-root-device-specified}

    If an error `No root-device specified` occurs when changing the root directory, mount the disk partitions.

    1. [Boot the server into Rescue recovery and diagnostics mode](/cloud-servers/troubleshooting/boot-to-rescue.mdx#boot-server-to-rescue).

    2. Connect to the cloud server in Rescue mode [via the console in the control panel](/cloud-servers/manage/connect-to-server.mdx#connect-through-console) or [via SSH](/cloud-servers/manage/connect-to-server.mdx#connect-via-ssh).

    3. View the disk file system and copy the partition IDs:

       ```bash
       fdisk -l
       ```

    4. Mount all disk partitions:

       ```bash
       infiltrate-root <block_uuid_1>
       infiltrate-root <block_uuid_2>
       ```

       Specify `<block_uuid_1>` and `<block_uuid_1>` — the IDs of the disk partitions you copied in step 3.

    5. [Exit Rescue mode](/cloud-servers/troubleshooting/boot-to-rescue.mdx#exit-rescue-mode). The server will restart automatically.
  </TabItem>

  <TabItem value="windows">
    <TabItemLabel>
      Windows
    </TabItemLabel>

    1. [Boot the server into Rescue recovery and diagnostics mode](/cloud-servers/troubleshooting/boot-to-rescue.mdx#boot-server-to-rescue).

    2. Connect to the cloud server in Rescue mode [via the console in the control panel](/cloud-servers/manage/connect-to-server.mdx#connect-through-console) or [via RDP](/cloud-servers/manage/connect-to-server.mdx#connect-via-rdp).

    3. Create a directory to mount the disk partition:

       ```bash
       mkdir /mnt
       ```

    4. View the disk partition where the operating system is located — this is the partition with the larger size:

       ```bash
       fdisk -l
       ```

    5. Mount the disk partition with the OS to the `/mnt` directory you created in step 3:

       ```bash
       ntfs-3g /dev/sda4 /mnt
       ```

       Here `sda4` is the disk partition where the operating system is located.

    6. Go to the `/mnt/Windows/System32/config/:` directory:

       ```bash
       cd /mnt/Windows/System32/config/
       ```

    7. Open the user list and copy the RID of the `Administrator:` user:

       ```bash
       chntpw -l SAM
       ```

    8. Switch to account editing mode:

       ```bash
       chntpw -u 0x<rid> SAM
       ```

       Specify `<rid>` — the RID of the Administrator user you copied in step 7.

    9. To reset the password, select `Clear (blank) user password`. Items may differ in different versions of the program; in the example, it is item 1:

       ```bash
       1
       ```

    10. Close the file:

        ```bash
        q
        ```

    11. Confirm the changes:

        ```bash
        y
        ```

    12. Check that the password has been reset:

        ```bash
        chntpw -l SAM
        ```

        In the response, the `LOCK` column for the Administrator user will display `*BLANK*`:

        ```bash
        | RID -|---------- Username -------------| Admin?|- Lock? - |
        | 01f4 | Administrator                   | ADMIN | *BLANK*  |
        ```

    13. [Exit Rescue mode](/cloud-servers/troubleshooting/boot-to-rescue.mdx#exit-rescue-mode). The server will restart automatically.

    14. Connect to the cloud server in Rescue mode [via the console in the control panel](/cloud-servers/manage/connect-to-server.mdx#connect-through-console) or [via RDP](/cloud-servers/manage/connect-to-server.mdx#connect-via-rdp). After resetting the password, you can make the first connection without entering a password.

    15. Set a new password on the server. To do this, go to **Settings** → **Accounts** → **Sign-in Options**.

    16. In the **Password** block, click **Add**.

    17. Enter a new password.

    18. Click **OK**.
  </TabItem>
</Tabs>

<Formbricks />
