How to reset the root password on Ubuntu 16.04 / Debian 7-8 / 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

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).

Boot menu and timer appearing before OS startup

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

Boot entry selected in GRUB to boot the OS in single-user mode

  1. Find the line that starts with linux /boot
  2. Change the parameter ro to rw and add the parameter init=/bin/bash at the end of the line

Editing the GRUB parameter and booting the system

  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