One of the mount points in a GNU/Linux system is the root mountpoint (usually referred to as ‘/’). This is the root of the entire file system and any file or directory on the machine can be referenced from this point.
The chroot command ‘changes the root’ to another location. Why would you want to do that? One of the more popular reasons is to create a sandbox for either an application or a user. Once a new root is declared via chroot, any references that a user or application makes to ‘/’ will resolve to the new directory. This is a pretty effective way to restrict access to the real root and therefore the real file system. In fact, sometimes that act of chrooting is referred to a jailing or a chrooted shell is referred to as a jail shell.
Note: My Kubuntu box is down right now and chroot doesn’t work properly on my Linspire box. Therefore, I have not tested these commands. If you spot any errors, please leave a comment for me.
This changes the root of my file system to /home/jon. From now on, references like:
Will cause nano (a text editor) to open up the textfile file in the /home/jon directoy.
Arguably, the chroot command is much more useful on a server to contain bad programs or users, but home users should be aware of chroot’s function.