Root Password Reset
Jump to navigation
Jump to search
Resetting the root account password on the PVE Host
The following follows the general method for resetting a root password on a Linux machine, if you have access to the console see e.g.:
for similar suggestions.
Keep in mind that editing the kernel command-line might need a different key-entry based on your boot-loader (e
works for both grub
and systemd-boot
though).
The method works for Proxmox VE until version 8.1 and should work for many other Linux based Operating systems as well:
Method 1
- Boot into your bootloader (mostly
grub
orsystemd-boot
, select your preferred kernel but do not press enter. - Press e to go into edit mode.
- Depending on the boot-loader go to the kernel-commandline entry:
- For
grub
: scroll down to thekernel
line you will boot from, it starts withlinux /vmlinuz-...
- For
systemd-boot
the kernel commandline is directly editable
- For
- Scroll to the end of that line, optionally remove the
quiet
in the line and appendinit=/bin/bash
- For
grub
pressCtrl X
to boot, forsystemd-boot
simply press Enterg
In the resulting shell:
# Remount / as Read/Write mount -o remount,rw /
# Change the root account password with passwd
# Change any other account password with passwd username
# type new password, confirm and hit enter and then reboot.
Method 2
- Boot from another installation of Debian. (One can use a LiveCD to get access to the "/" partition.)
- Then, mount the partition where you have Debian's "/" (root directory), then change directory to /mnt/etc
- Used vim / nano as an editor to edit the file shadow.
- Find the line starting with root: (or another username)
- Delete everything between the first and second colons (:), and the line will now look like:
root::$6$fsdsdgdsg74.:14862:0:99999:7:::
- Reboot and login as root (or another username as used above) without a password.
- At the end use passwd to set a new password for the root account (or passwd username to change any account password).
- Reboot and login as root with the new root password.
Resetting the root account password in a Container
- Enter the working container and change the password using:
pct enter <VEID> passwd <new password> exit
- When using OpenVZ containers (up to PVE 3.4) use
vzctl enter <VEID>
to enter the container.