How to reset the root password on Ubuntu 18.04+ / Debian 9+ / Proxmox on a dedicated server

If you have lost the root password for the server and cannot log in with superuser privileges, this article will help you resolve the issue without requiring the old password.

Reboot the server using the VNC console

  1. Open the Customer Portal and navigate to Dedicated ServersManage
  2. Select the server and click VNC console in the Details section
  3. In the VNC console window, click the Send CtrlAltDel button

VNC console window with Send CtrlAltDel button highlighted

Before the OS starts and after the BIOS menu, a boot menu and timer will appear. To stop the timer, press any key (such as any arrow key or Ctrl).

Stopping the boot timer by pressing any key

Boot the OS in single-user mode

To boot the OS in single-user mode, you need to change the kernel boot parameters in the GRUB bootloader menu:

  1. Use the and keys to navigate the menu and select the boot line (usually named "Ubuntu" or "Debian")
  2. Press the E key to access the boot mode editing options
  3. Find the line that starts with linux /vmlinuz
  4. Change the parameter ro to rw and add the parameter init=/bin/bash at the end of the line

Booting the system in single-user mode via GRUB parameter edit

  1. Boot the system in single-user mode by pressing CTRL+X or F10

The server will reboot and the console will open.

Set a new root password

  1. In the console, execute the command:

    passwd root
  2. Enter the new root user password twice — the root user password is changed

  3. Save the changes to disk and reboot the server:

    sync reboot -f

The new root user password will be set.

On this page