chroot(1M) DG/UX 5.4.2 chroot(1M)
NAME
chroot - change root directory for a command
SYNOPSIS
/usr/sbin/chroot newroot command
DESCRIPTION
Chroot executes command relative to newroot. After executing chroot,
the initial slash (/) in subsequent pathnames is changed to the new
root directory you specify. newroot becomes the initial working
directory.
The new root is always relative to the current root. If a chroot is
currently in effect (for example, a sh or csh command), newroot is
relative to the current root of the running process, not the original
root (/).
Changing the root for command does not change the root for chroot.
Thus, I/O redirection is relative to the old root directory.
Only the superuser can use the chroot command.
EXAMPLES
/usr/sbin/chroot /usr/alex/test /grep pattern /file1 > grep.out
/usr/alex/test/grep pattern /usr/alex/test/file1 > grep.out
These two lines are equivalent. Note that I/O redirection is
relative to the original root, not the new one.
SEE ALSO
chdir(2), chroot(2).
NOTES
Be careful if you wish to reference special files in the new root
file system. Unless the new root is /dev or you have copies of the
/dev files within the range of the new root, these special files will
be inaccessible.
Also note that in order to use shared executables in the new root
file system, the shared libraries referenced by the executables must
exist in the new root. Use the ldd(1) command to list the dynamic
dependencies of an executable program.
The command given to chroot must either be specified with a full path
name (relative to newroot) or specified with a pathname relative to
the newroot directory. Specifically, the PATH environment variable
will not be used to search for command, but will be available for use
by command. If command is a shell script, it must begin with a line
that specifies the shell to be used, e.g. #!/bin/sh
Licensed material--property of copyright holder(s) 1