Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
CHROOT(8)		FreeBSD	System Manager's Manual		     CHROOT(8)

NAME
     chroot -- change root directory

SYNOPSIS
     chroot [-G	group[,group ...]] [-g group] [-u user]	newroot
	    [command [arg ...]]

DESCRIPTION
     The chroot	utility	changes	its current and	root directories to the	sup-
     plied 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:

     -G	group[,group ...]  Run the command with	the permissions	of the speci-
			   fied	groups.

     -g	group		   Run the command with	the permissions	of the speci-
			   fied	group.

     -u	user		   Run the command as the user.

ENVIRONMENT
     The following environment variable	is referenced by chroot:

     SHELL  If set, the	string specified by SHELL is interpreted as the	name
	    of the shell to exec.  If the variable SHELL is not	set, /bin/sh
	    is used.

EXAMPLES
     Example 1:	Chrooting into a New Root Directory

       The following command opens the csh(1) shell after chrooting to the
       standard	root directory.

	 # chroot / /bin/csh

     Example 2:	Execution of a Command with a Changed Root Directory

       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

SEE ALSO
     chdir(2), chroot(2), setgid(2), setgroups(2), setuid(2), getgrnam(3),
     environ(7), jail(8)

HISTORY
     The chroot	utility	first appeared in AT&T System III UNIX and
     4.3BSD-Reno.

FreeBSD	13.0			 June 27, 2020			  FreeBSD 13.0

NAME | SYNOPSIS | DESCRIPTION | ENVIRONMENT | EXAMPLES | SEE ALSO | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=chroot&sektion=8&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help