xref: /openbsd-src/usr.sbin/chroot/chroot.8 (revision 87ee06021e4a58e9e873f96f5bab477b78a2dd4a)
1*87ee0602Sschwarze.\"	$OpenBSD: chroot.8,v 1.16 2015/09/12 15:52:37 schwarze Exp $
2f23c3decSmickey.\"
385a90bd5Smillert.\" Copyright (c) 1988, 1991, 1993
485a90bd5Smillert.\"	The Regents of the University of California.  All rights reserved.
5df930be7Sderaadt.\"
6df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
7df930be7Sderaadt.\" modification, are permitted provided that the following conditions
8df930be7Sderaadt.\" are met:
9df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
10df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
11df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
12df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
13df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
1429295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors
15df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
16df930be7Sderaadt.\"    without specific prior written permission.
17df930be7Sderaadt.\"
18df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28df930be7Sderaadt.\" SUCH DAMAGE.
29df930be7Sderaadt.\"
3085a90bd5Smillert.\"     from: @(#)chroot.8	8.1 (Berkeley) 6/9/93
31df930be7Sderaadt.\"
32*87ee0602Sschwarze.Dd $Mdocdate: September 12 2015 $
33df930be7Sderaadt.Dt CHROOT 8
34fc8533a3Saaron.Os
35df930be7Sderaadt.Sh NAME
36df930be7Sderaadt.Nm chroot
37df930be7Sderaadt.Nd change root directory
38df930be7Sderaadt.Sh SYNOPSIS
39df930be7Sderaadt.Nm chroot
40*87ee0602Sschwarze.Op Fl g Ar group Ns Op Pf , Ar group Ns Op Pf , Ar ...
41fe1256fcSmpech.Op Fl u Ar user
42df930be7Sderaadt.Ar newroot
43df930be7Sderaadt.Op Ar command
44df930be7Sderaadt.Sh DESCRIPTION
45df930be7SderaadtThe
46903c86c8Saaron.Nm
47df930be7Sderaadtcommand changes its root directory to the supplied directory
48df930be7Sderaadt.Ar newroot
496f10db5aSaaronand executes
50df930be7Sderaadt.Ar command ,
5185a90bd5Smillertif supplied, or an interactive copy of the user's shell.
52df930be7Sderaadt.Pp
5385a90bd5SmillertThe
5485a90bd5Smillert.Nm
5585a90bd5Smillertcommand is restricted to the superuser.
5685a90bd5Smillert.Pp
5785a90bd5SmillertThe options are as follows:
5885a90bd5Smillert.Bl -tag -width Ds
59*87ee0602Sschwarze.It Fl g Ar group Ns Op Pf , Ar group Ns Op Pf , Ar ...
60fe1256fcSmpechOverride the primary and supplemental group IDs.
61fe1256fcSmpechThe primary group ID is set to the first group in the list.
62fe1256fcSmpechAny remaining groups are placed in the supplemental group ID vector.
63fe1256fcSmpechEach group listed must exist in the
64fe1256fcSmpech.Xr group 5
65fe1256fcSmpechdatabases.
6685a90bd5Smillert.It Fl u Ar user
6785a90bd5SmillertSet user ID to
6885a90bd5Smillert.Ar user
69466b9fa7Smillert(which must exist in the
7003d641a9Smillert.Xr passwd 5
71466b9fa7Smillertdatabase).
72466b9fa7SmillertThe primary and supplemental group IDs will be set based on the user's
73466b9fa7Smillertentries in the
74466b9fa7Smillert.Xr passwd 5
75466b9fa7Smillertand
76466b9fa7Smillert.Xr group 5
77466b9fa7Smillertdatabases unless overridden by the
78466b9fa7Smillert.Fl g
79466b9fa7Smillertoption.
8014fcad98SmillertAdditional settings may be applied as specified in
8114fcad98Smillert.Xr login.conf 5
8214fcad98Smillertdepending on
8314fcad98Smillert.Ar user Ns 's
8414fcad98Smillertlogin class.
8585a90bd5Smillert.El
86df930be7Sderaadt.Sh ENVIRONMENT
87df930be7Sderaadt.Bl -tag -width SHELL
88df930be7Sderaadt.It Ev SHELL
89df930be7SderaadtIf set,
90df930be7Sderaadtthe string specified by
91df930be7Sderaadt.Ev SHELL
92df930be7Sderaadtis interpreted as the name of
936f10db5aSaaronthe shell to execute.
94df930be7SderaadtIf the variable
95df930be7Sderaadt.Ev SHELL
96df930be7Sderaadtis not set,
97df930be7Sderaadt.Pa /bin/sh
98df930be7Sderaadtis used.
99df930be7Sderaadt.El
100df930be7Sderaadt.Sh SEE ALSO
1013f9b732fSjmc.Xr ldd 1 ,
102466b9fa7Smillert.Xr group 5 ,
10314fcad98Smillert.Xr login.conf 5 ,
104466b9fa7Smillert.Xr passwd 5 ,
105df930be7Sderaadt.Xr environ 7
106df930be7Sderaadt.Sh HISTORY
107df930be7SderaadtThe
108df930be7Sderaadt.Nm
10985a90bd5Smillertutility first appeared in
1103f9b732fSjmc.Bx 4.3 Reno .
11185a90bd5Smillert.Sh CAVEATS
11285a90bd5Smillert.Nm
11385a90bd5Smillertshould never be installed setuid root, as it would then be possible
11485a90bd5Smillertto exploit the program to gain root privileges.
115