2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH CHROOT 1M "Dec 15, 2003"
9 chroot \- change root directory for a command
13 \fB/usr/sbin/chroot\fR \fInewroot\fR \fIcommand\fR
19 The \fBchroot\fR utility causes \fIcommand\fR to be executed relative to
20 \fInewroot\fR. The meaning of any initial slashes (\fB\|/\|\fR) in the path
21 names is changed to \fInewroot\fR for \fIcommand\fR and any of its child
22 processes. Upon execution, the initial working directory is \fInewroot\fR.
25 Notice that redirecting the output of \fIcommand\fR to a file,
29 chroot\fI newroot \|command\fR >\fBx\fR
36 will create the file \fBx\fR relative to the original root of \fIcommand\fR,
40 The new root path name is always relative to the current root. Even if a
41 \fBchroot\fR is currently in effect, the \fInewroot\fR argument is relative to
42 the current root of the running process.
45 This command can be run only by the super-user.
49 The exit status of \fBchroot\fR is the return value of \fIcommand\fR.
52 \fBExample 1 \fRUsing the \fBchroot\fR Utility
55 The \fBchroot\fR utility provides an easy way to extract \fBtar\fR files (see
56 \fBtar\fR(1)) written with absolute filenames to a different location. It is
57 necessary to copy the shared libraries used by \fBtar\fR (see \fBldd\fR(1)) to
58 the \fInewroot\fR filesystem.
63 example# mkdir /tmp/lib; cd /lib
64 example# cp ld.so.1 libc.so.1 libcmd.so.1 libdl.so.1 \e
66 example# cp /usr/bin/tar /tmp
67 example# dd if=/dev/rmt/0 | chroot /tmp tar xvf -
75 \fBcd\fR(1), \fBtar\fR(1), \fBchroot\fR(2), \fBttyname\fR(3C),
80 Exercise extreme caution when referencing device files in the new root file
84 References by routines such as \fBttyname\fR(3C) to stdin, stdout, and stderr
85 will find that the device associated with the file descriptor is unknown after