Chroot — change root — is the *n?x utility to run something with an arbitrary directory acting as its root directory. Anything in one will see the specified directory as /, and have no good way of knowing that there's a filesystem outside it.

chroot new-root commands
chroot options

(Run commands (a shell, by default) with new-root as /, the root directory.)

For recovery: suppose you're booting a Linux machine off a CD because you've misconfigured the bootloader. Do something like this:

root$ mkdir /mnt/recovery
root$ mount /dev/hda3 /mnt/recovery
root$ chroot /mnt/recovery

Now you can see your files as though you had booted normally, and conveniently repair stuff using tools on the main disk. Of course, the rest of your system will stay as it was; the kernel certainly doesn't retroactively pretend it started off whatever you decide to call / (then again, see usermode Linux). You can use several chroots at once, and they won't get confused; each new environment is self-contained. Chroot isn't necessary to do this (you could just put /mnt/hda3/" before every command, and maybe softlink the library directories), but it makes things much simpler.

For security: when you want people or programs to have access to parts of your system without all the privileges of a normal user or process, you can put them in a chroot jail: a directory that looks something like /, but with no access to whatever you'd rather keep clean in the real /. Many ftp daemons do this by default, and it's also useful for testing potentially dangerous programs. Crackers are often caught while breaking into chroot-jailed programs.

Chroot is often pronounced change root, ch'root, or C H root, but cool people say cheroot, like the cigar.