In my PC, Linux is already installed and I forgot the password. I want to recover my Linux system password. How can I do it, step by step?
init=/bin/bash is by far NOT the easiest way to do this. Boot into single user mode.
From the boot loader, instead of
init=/bin/bash, just add the word "single" (without quotes).
The system will boot up as usual but drop you to a Bash prompt never asking you for a password and already having mounted the system as rw. Then reset your password with the passwd command.
When you're done run
for CLI startup
No mounting, remounting, rebooting, booting from live CDs or distributions are needed when done.
Fastest way is to pass the parameter
init=/bin/bash to the boot loader (see an example here). That would give you a root console pretty much immediately, now
mount -a and
mount -o remount,rw / to get access to the system. Finally, a
passwd command should allow you to set the root password.
Second option (since nowadays linux distro need a ramdisk with drivers when they start) is to boot with a live distro, then mount your linux partition somewhere (a-la
mount /dev/sda1 /mnt), mount also
/dev (devfs usually) into the new partition (
mount --bind /proc /mnt/proc and
mount --bind /dev /mnt/dev). Finally,
chroot /mnt and
mount -a should give you your system back. Now, sometimes live distro see your hard disk as
sd (the old SCSI mapper, now used for SATA disks), so you might end up with
/dev/hda mapped to
/dev/sda. That were the case you need to mount by hand all that you find in your
/mnt/etc/fstab file. Once that's done you can try the
chroot again, and then
If you find this complicated learn the lesson: (1) don't use root (2) don't use root (3) use sudo