Re: chroot bug, & Re: Ideas for v2.1

Warner Losh (imp@village.org)
Fri, 14 Jun 1996 00:29:53 -0600


: > This is the normal behaviour,
:
: No it isn't.
: The man page for chroot on a SysV or BSD system states:
: chroot causes the given command to be executed relative to
: the new root. The meaning of any initial slashes (/) in the
: pathnames is changed for the command and any of its child
: processes to newroot. Furthermore, upon execution, the
: initial working directory is newroot.
:
: chroot(8) is broken if it doesn't leave you in newroot.

Hmmm, my FreeBSD man page says different:

NAME
chroot - change root directory
...
DESCRIPTION
Dirname is the address of the pathname of a directory, terminated by an
ASCII NUL. Chroot() causes dirname to become the root directory, that
is, the starting point for path searches of pathnames beginning with `/'.

In order for a directory to become the root directory a process must have
execute (search) access for that directory.

It should be noted that chroot() has no effect on the process's current
directory.

Warner