1.\" Copyright (c) 1988, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" from: @(#)chroot.8 8.1 (Berkeley) 6/9/93 33.\" $NetBSD: chroot.8,v 1.8 1999/03/22 18:43:51 garbled Exp $ 34.\" 35.Dd October 6, 1998 36.Dt CHROOT 8 37.Os 38.Sh NAME 39.Nm chroot 40.Nd change root directory 41.Sh SYNOPSIS 42.Nm 43.Op Fl u user 44.Op Fl g group 45.Op Fl G group,group,... 46.Ar newroot 47.Op Ar command 48.Sh DESCRIPTION 49The 50.Nm 51command changes its root directory to the supplied directory 52.Ar newroot 53and exec's 54.Ar command , 55if supplied, or an interactive copy of your shell. 56.Pp 57If the 58.Fl u , 59.Fl g 60or 61.Fl G 62options are given, the user, group and group list of the process are 63set to these values after the chroot has taken place. See 64.Xr setgid 2 , 65.Xr setgroups 2 , 66.Xr setuid 2 , 67.Xr getgrnam 3 68and 69.Xr getpwnam 3 . 70.Pp 71Note, 72.Ar command 73or the shell are run as your real-user-id. 74.Sh ENVIRONMENT 75The following environment variable is referenced by 76.Nm "" : 77.Bl -tag -width SHELL 78.It Ev SHELL 79If set, 80the string specified by 81.Ev SHELL 82is interpreted as the name of 83the shell to exec. 84If the variable 85.Ev SHELL 86is not set, 87.Pa /bin/sh 88is used. 89.El 90.Sh SEE ALSO 91.Xr chdir 2 , 92.Xr chroot 2 , 93.Xr environ 7 94.Sh HISTORY 95The 96.Nm 97utility first appeared in 98.Bx 4.4 . 99.Sh SECURITY CONSIDERATIONS 100.Nm 101should never be installed setuid root, as it would then be possible 102to exploit the program to gain root privileges. 103