---
title: "Reset and recover a dedicated server password"
sidebar_label: "Reset and recover a dedicated server password"
sidebar_position: 2
description: "How to reset and recover a dedicated server password in Rescue and WinPE recovery and diagnostic modes"
---

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

# Reset and recover a dedicated server password

You can view the root password in the [Control panel](https://my.selectel.ru/servers/): in the top menu, click **Products** → **Dedicated Servers** → **Servers** → server page → **Operating System** tab. The password is available for viewing for 24 hours from the start of OS installation or reinstallation, or configuration changes.

If you have forgotten or lost your password, you can recover it using [recovery and diagnostic modes](/dedicated/troubleshooting/boot-to-recovery.mdx):

* for Linux and Windows servers — [restore the server password in Rescue](#restore-server-password-via-rescue);
* for Windows servers — [restore the server password in WinPE](#restore-server-password-via-winpe).

You cannot recover the password for servers with macOS. To continue using the server, [create a ticket](https://my.selectel.ru/tickets/create).

## Restore the server password in Rescue \{#restore-server-password-via-rescue}

<Tabs queryString="restore-server-password-via-rescue">
  <TabItem value="ubuntu-debian" default>
    <TabItemLabel>
      Ubuntu and Debian
    </TabItemLabel>

    1. [Boot the server in Rescue recovery and diagnostic mode](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).

    2. Connect to the server in Rescue mode via [KVM console](/dedicated/manage/connect-to-server.mdx#connect-via-kvm-console) or [via SSH](/dedicated/manage/connect-to-server.mdx#connect-via-ssh).

    3. [Mount the OS file system](/dedicated/troubleshooting/mount-file-system.mdx).

    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 the confirmation that the password has been changed:

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

    7. If [you mounted the file system manually](/dedicated/troubleshooting/mount-file-system.mdx#mount-manually) using the `mount` command, synchronize the data:

       ```bash
       sync
       ```

    8. Exit the environment:

       ```bash
       exit
       ```

    9. If [you mounted the file system manually](/dedicated/troubleshooting/mount-file-system.mdx#mount-manually) using the `mount` command, unmount the file system:

       ```bash
       umount /dev/<partition> /mnt
       ```

       Specify `<partition>` — the disk partition you mounted the file system to in step 3.

    10. [Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or restart the server from the OS. When you restart the server from the OS, the boot template will automatically change to the one that was set before [changing the server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).
  </TabItem>

  <TabItem value="centos">
    <TabItemLabel>
      CentOS
    </TabItemLabel>

    1. [Boot the server in Rescue recovery and diagnostic mode](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).

    2. Connect to the server in Rescue mode via [KVM console](/dedicated/manage/connect-to-server.mdx#connect-via-kvm-console) or [via SSH](/dedicated/manage/connect-to-server.mdx#connect-via-ssh).

    3. [Mount the OS file system](/dedicated/troubleshooting/mount-file-system.mdx).

    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. Update the password checksums:

       ```bash
       touch /.autorelabel
       ```

    7. If [you mounted the file system manually](/dedicated/troubleshooting/mount-file-system.mdx#mount-manually) using the `mount` command, synchronize the data:

       ```bash
       sync
       ```

    8. Exit the environment. The partition will be unmounted automatically:

       ```bash
       exit
       ```

    9. [Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or restart the server from the OS. When you restart the server from the OS, the boot template will automatically change to the one that was set before [changing the server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).
  </TabItem>

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

    1. [Boot the server in Rescue recovery and diagnostic mode](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).

    2. Connect to the server in Rescue mode via [KVM console](/dedicated/manage/connect-to-server.mdx#connect-via-kvm-console) or [via SSH](/dedicated/manage/connect-to-server.mdx#connect-via-ssh).

    3. Display information about the partitions on the available disks:

       ```bash
       lsblk
       ```

       A list of disks and their partitions will appear in the response. For example:

       ```bash
       NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
       sda       8:0    0   2.9G  0 disk
       └─sda1    8:1    0   2.9G  0 part
       sdb       8:16   0   160G  0 disk
       ├─sdb1    8:17   0 159.9G  0 part
       ├─sdb14   8:30   0     4M  0 part
       └─sdb15   8:31   0   106M  0 part
       ```

       Here, `sda1`, `sdb1`, `sdb14`, `sdb15` are disk partitions. Partition names may differ in your OS.

    4. Select the system partition; usually, this is the largest partition on the disk. In the example in step 2, this is the `sdb1` partition.

    5. Mount the disk partition with the OS to the `/mnt` directory:

       ```bash
       mount -t ntfs-3g /dev/<partition> /mnt
       ```

       Specify `<partition>` — the disk partition you selected in step 4.

    6. Switch to the Administrator user account editing mode:

       ```bash
       chntpw -u Administrator /mnt/Windows/System32/config/SAM
       ```

    7. To reset the password, select the `Clear (blank) user password` item. The items may differ in different versions of the program; in the example, this is item 1:

       ```bash
       1
       ```

    8. Close the file:

       ```bash
       q
       ```

    9. Confirm the changes:

       ```bash
       y
       ```

    10. [Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or restart the server from the OS. When you restart the server from the OS, the boot template will automatically change to the one that was set before [changing the server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).

    11. [Connect to the server](/dedicated/manage/connect-to-server.mdx). After resetting the password, you can log in once without a password.

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

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

    14. Enter a new password.

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

## Restore the server password in WinPE \{#restore-server-password-via-winpe}

1. [Boot the server in WinPE recovery and diagnostic mode](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).

2. Connect to the server in WinPE mode via [KVM console](/dedicated/manage/connect-to-server.mdx#connect-via-kvm-console) or [via VNC](/dedicated/manage/connect-to-server.mdx#connect-via-vnc).

3. Run the [NTPWEdit](http://cdslow.org.ru/ntpwedit/) password editing utility.

4. Ensure that the **Path to SAM file** field contains the path to the `SAM` file — this is the Security Account Manager file.

5. Click **Open**.

6. Select the user account. If the account is locked, unlock it — click **Unlock**.

7. Click **Change password**.

8. Enter the new password. If you set an empty password, you will not be able to connect via RDP or change the password using the `NTPWEdit` utility.

9. Confirm the password.

10. Click **OK**.

11. Click **Save changes**.

12. [Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or restart the server from the OS. When you restart the server from the OS, the boot template will automatically change to the one that was set before [changing the server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).

<Formbricks />
