GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
CHROOT(8) FreeBSD System Manager's Manual CHROOT(8)

chroot
change root directory

chroot [-G group[,group ...]] [-g group] [-u user] [-n] 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:

group[,group ...]
Run the command with the permissions of the specified groups.
group
Run the command with the permissions of the specified group.
user
Run the command as the user.
Use the PROC_NO_NEW_PRIVS_CTL procctl(2) command before chrooting, effectively disabling SUID/SGID bits for the calling process and its descendants. If security.bsd.unprivileged_chroot sysctl is set to 1, it will make it possible to chroot without superuser privileges.

The following environment variable is referenced by chroot:
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.

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

    

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

The chroot utility first appeared in AT&T System III UNIX and 4.3BSD-Reno.
July 20, 2021 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 8 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.