I tried to explain what "chrooting" is to a group of starting Linux gurus. It seemed rather difficult to explain. So, maybe an illustrated article will explain what chroot is.
From chroot's manpage:
chroot - run command or interactive shell with special root directory
And in my own words:
chroot starts a process in a directory which looks like the root directory to that process.
Here is an example of how chroot can be used to reset a root password on an existing system. (Even works when the bootloader (grub) has a password set.)
- Insert a linux boot or install CD/DVD and make the computer boot from that cd.
- When the CD boots and starts the installer, hit [CTRL]+[ALT]+[F2] to go to a shell.
- Now that you have a shell available, you must mount the / (maybe /usr too) directory. Mostly you don't know what directory was the / directory, so you will end up mounting an unmounting a few times.
mkdir /mnt/a && mount /dev/sda5 /mnt/a && mount /dev/sda3 /mnt/a/usr
- When you have the required mountpoints mounted, execute a chroot, like this:
chroot /mnt/a /bin/sh
- Now you can execute passwd, which is actually /mnt/a/usr/bin/passwd. The password will be updated in /etc/shadow, which is actually /mnt/a/etc/shadow