so lets start:
1 EDITING LOADER (in my case it will be GRUB)
boot machine
when the GRUB menu appears, use arrow keys to choose OS to be booted
press letter "e'' on the keyboard to enter edit mode
use arrow keys to select the kernel line for kernel to be booted
press "e" to edit line
go to end of line and type "single" (without quotes) as a separate word
press ESC key to exit the edit mode
press "b" to boot into single user mode
after booting you can set password for root by running passwd commnad
reboot and login with new pw
2. MAGIC WAY :)
If the easy method doesn't work on your machine, another way to solve the "lost root password" problem is to boot your computer from your Linux Installation CD/DVD, or from a live-CD/DVD such as Knoppix.
Boot with the live-disk then go to a terminal and su to root (no password is required) then issue the following commands (be sure to replace each /sda1 with your own root partition device):
Code:
mount -o dev,rw /mnt/sda1 cd /mnt/sda1/etc
For example, the /etc/shadow entry for the "root" account may look something like this:
Code:
root:$1$aB7mx0Licb$CTbs2RQrfPHkz5Vna0.fnz8H68tB.:10852:0:99999:7:::
Code:
vim shadow
Code:
root::10852:0:99999:7:::
Code:
cd / umount /mnt/sda1
Once the computer has booted and you're at the login prompt, type "root" and when asked for the password just press ENTER (entering no password). After a successful login, you need to set the new password for root using the following command:
Code:
passwd
3.RECOVERY CONSOLE or LIVE CD/DVD
1.Boot from LIVECD or in RC
2. mount root partition
- if no raid on server than
mount /dev/hda2 /mnt/newroot
- if you have raid
mount /dev/md1 /mnt/newroot
NOTE make sure that you replace hhd name with your own
3. Bind /dev/random from your server
mount –bind /dev /mnt/newroot/dev
4. changing the root file system. (e.g.):
# chroot /mnt/newroot /bin/bash
5.change root password
passwd
6. reboot in normal mode
No comments:
Post a Comment