Resettare la password di root in Debian: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
Created page with "== Debian Squeeze change root password == === Method 1 === * Boot into '''grub''', select '''''single user''''' but '''do not press enter'''. * Press '''e''' to go into '''edi..."
 
 
Line 1: Line 1:
== Debian Squeeze change root password ==
== Debian change root password ==
=== 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, it starts with  
* Scroll to the end of that line and press '''space key''' once and type <tt>init=/bin/bash </tt>
linux /boot/vmlinuz-2.6....
* Scroll to the end of that line and press '''space key''' once and type  
init=/bin/bash
 
* Press '''Ctrl X''' to boot
* Press '''Ctrl X''' to boot


<source lang="bash">
* Remount / as Read/Write  
# Remount / as Read/Write  
mount -rw -o remount /
mount -rw -o remount /


# Change password with
* Change password with
passwd
passwd


# type new password, confirm and hit enter and then reboot.
* Type new password, confirm and hit enter and then reboot.
</source>


=== Method 2 ===
=== Method 2 ===

Latest revision as of 11:04, 20 February 2023

Debian change root password

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, it starts with
linux /boot/vmlinuz-2.6....
  • 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 password with
passwd
  • 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 Squeeze's "/", then changed directory to /mnt/etc
  • Used vim / nano as an editor to edit the file shadow.
  • Find the line starting with root:
  • Delete everything between the first and second colons (:), and the line will now look like:
root::$6$fsdsdgdsg74.:14862:0:99999:7:::
  • Reboot as root without a password.
  • At the end use passwd to set a new root password.
  • Reboot and login as root with the new root password.

References