On Unix-like operating systems, the chroot command runs a command or an interactive shell from another directory, and treats that directory as root. This process is called changing root and the new root directory is named chroot jail.

For a history of the command, and other information, see our chroot definition.

This page describes the GNU/Linux version of chroot.

Syntax

chroot [OPTION] NEWROOT [COMMAND [ARG]…]

chroot runs COMMAND with the root directory set to NEWROOT.

  • Syntax
  • Related commands
  • Linux commands help

OPTION may be one of the following:

If no command is specified, chroot executes the command ‘${SHELL} -i’. By default, this is ‘/bin/sh -i’. This will drop you into a sh shell as root in the NEWROOT directory.

chdir — The system function for changing the working directory.