Halaman

Jumat, 02 Maret 2012

Forgot Debian Root Password

Here I tell you what I did
  1. Reboot server.
  2. Press downarrow key, and grub-boot loader screen appears.
  3. I select the line start with "kernel /boot/vmlinuz-2.6.26-2.686 root=/dev/sda1 ro quiet".
  4. Press 'e' to edit the argument and modify the line to: "kernel /boot/vmlinuz-2.6.26-2.686 root=/dev/sda1 rw single init=/bin/bash"
  5. Press 'b' to boot
  6. Bash prompt appears....but I was facing the problem that the keyboard did not work..(I've got error messages something like:"Device not accepting", "Unenumerate", that tell USB port not recognized)....I am using KVM Switch. I did unplug the USB keyboard from KVM Switch then plugging in another USB keyboard.
  7. After repeating steps 1-5, I was able to type using the new keyboard.
  8. I was trying using mount command such as:
#mount -n -o remount rw /
#mount -rw -o remount /
#mount -t ext3 /dev/sda1 /usr

but passwd command failed. ("bash: passwd: command not found")
(Perhaps it would works if I (re)mount rest of all my partitions in read/write (rw) mode such as /usr /var etc, but i did not do at the time).

What I did then was disabling the root password from the password file using Nano editor. I've check that the second data field in /etc/passwd is “x” for every username, so the system uses shadow passwords, and I must edit /etc/shadow.
  1. #nano /etc/shadow
I changed==> root:this_is_the_encrypted_passwd:15401:0:99999:7:::
to this ====> root::15401:0:99999:7:::
(Edit the second data field in the password file so that it is empty.)

Reboot the system and at the login prompt, type root (without password).

Tidak ada komentar:

Posting Komentar