Difference between revisions of "Root Password Reset"

From Proxmox VE
Jump to navigation Jump to search
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Resetting the root account password on Debian (or any account password) ==
+
== Resetting the root account password on the PVE Host ==
This has been tested and is known to work with Debian versions 6, 7, and 8. It can also be used to change any account password.
+
 
 +
The following is quoted from [http://derwynd.com/2011/04/14/debian-squeeze-change-root-password/ Debian Squeeze change root password] and works for Proxmox VE3.x and 4.x (It can also be used to change any account password as well as for other Debian based distributions):
  
 
=== Method 1 ===
 
=== Method 1 ===
 
* Boot into '''grub''', select '''''single user''''' but '''do not press enter'''.
 
* Boot into '''grub''', select '''''single user''''' but '''do not press enter'''.
 
* Press '''e''' to go into '''edit''' mode.
 
* Press '''e''' to go into '''edit''' mode.
* Scroll down to the '''kernel''' line, it starts with "<tt>linux /boot/vmlinuz-2.6…….</tt>"
+
* Scroll down to the '''kernel''' line you will boot from, it starts with "<tt>linux /boot/vmlinuz-…….</tt>"
 
* Scroll to the end of that line and press '''space key''' once and type <tt>init=/bin/bash </tt>
 
* Scroll to the end of that line and press '''space key''' once and type <tt>init=/bin/bash </tt>
 
* Press '''Ctrl X''' to boot
 
* Press '''Ctrl X''' to boot
  
<source lang="bash">
 
# Remount / as Read/Write
 
mount -rw -o remount /
 
  
# Change the root account password with
+
# Remount / as Read/Write
passwd
+
mount -rw -o remount /
 +
 
 +
# Change the root account password with
 +
passwd
 +
 
 +
# Change any other account password with
 +
passwd username
  
# Change any other account password with
+
# type new password, confirm and hit enter and then reboot.
passwd username
 
  
# type new password, confirm and hit enter and then reboot.
 
</source>
 
  
 
=== Method 2 ===
 
=== Method 2 ===
Line 32: Line 33:
 
* At the end use '''passwd''' to set a new password for the root account (or '''passwd username''' to change any account 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.
 
* 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.
  
 
== References ==
 
== References ==
Line 38: Line 55:
 
* https://wiki.debian.org/Root
 
* https://wiki.debian.org/Root
  
[[Category: HOWTO]]
+
[[Category: HOWTO]] [[Category:System Administration]]

Revision as of 15:07, 16 May 2019

Resetting the root account password on the PVE Host

The following is quoted from Debian Squeeze change root password and works for Proxmox VE3.x and 4.x (It can also be used to change any account password as well as for other Debian based distributions):

Method 1

  • Boot into grub, select single user but do not press enter.
  • Press e to go into edit mode.
  • Scroll down to the kernel line you will boot from, it starts with "linux /boot/vmlinuz-……."
  • Scroll to the end of that line and press space key once and type init=/bin/bash
  • Press Ctrl X to boot


# Remount / as Read/Write 
mount -rw -o remount /
# 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.

References