CHROOT(8) | System Manager's Manual | CHROOT(8) |
chroot
— change
root directory
chroot |
[-G
group[, group
...]] [-g group]
[-u user]
newroot [command
[arg ...]] |
The chroot
utility changes its current and
root directories to the supplied directory newroot and
then exec's command with provided arguments, if
supplied, or an interactive copy of the user's login shell.
The options are as follows:
The following environment variable is referenced by
chroot
:
SHELL
SHELL
is
interpreted as the name of the shell to exec. If the variable
SHELL
is not set, /bin/sh
is used.The following command opens the csh(1) shell after chrooting to the standard root directory.
#
chroot / /bin/csh
The following command changes a root directory with
chroot
and then runs
ls(1) to list the contents of
/sbin.
#
chroot /tmp/testroot ls /sbin
chdir(2), chroot(2), setgid(2), setgroups(2), setuid(2), getgrnam(3), environ(7)
The chroot
utility first appeared in
AT&T System III UNIX and
4.3BSD-Reno.
July 20, 2021 | macOS 14.6 |