2025-03-14 21:59:59 -06:00
|
|
|
# chroot
|
|
|
|
|
|
|
|
|
|
> Run command or interactive shell with special root directory.
|
|
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/chroot-invocation.html>.
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
- Run `$SHELL` in the new root directory:
|
|
|
|
|
|
|
|
|
|
`sudo chroot {{path/to/new_root}}`
|
|
|
|
|
|
2025-03-14 21:59:59 -06:00
|
|
|
- Run command as new root directory:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`sudo chroot {{path/to/new_root}} {{command}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Use a specific user and group:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`sudo chroot --userspec {{username_or_id}}:{{group_name_or_id}} {{path/to/new_root}}`
|