NOTE

chroot

Chroot makes a chosen directory the root seen by a process. These notes record its usage for isolating the file-system view.

Operating Systems / LinuxCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Is chroot?

In Linux, chroot is used to change the root directory. In a Linux system, the default directory structure begins with /; chroot uses a specified location as /.

2. Why chroot Is Needed

2.1. Security

Restrict user privileges.

2.2. Isolation

Create a system directory structure isolated from the original system to make development easier.

3. How to Use chroot

mkdir -p new_root/bin
cp /bin/bash new_root/bin
cp -r /lib new_root
cp -r /lib64 new_root
sudo chroot new_root

4. How chroot Works

5. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub