From owner-freebsd-security Mon Sep 9 12:18:46 1996 Return-Path: owner-security Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA13212 for security-outgoing; Mon, 9 Sep 1996 12:18:46 -0700 (PDT) Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id MAA13201 for ; Mon, 9 Sep 1996 12:18:42 -0700 (PDT) Received: by halloran-eldar.lcs.mit.edu; (5.65v3.2/1.1.8.2/19Aug95-0530PM) id AA06748; Mon, 9 Sep 1996 15:18:34 -0400 Date: Mon, 9 Sep 1996 15:18:34 -0400 From: Garrett Wollman Message-Id: <9609091918.AA06748@halloran-eldar.lcs.mit.edu> To: rkw@dataplex.net (Richard Wackerbarth) Cc: security@freebsd.org Subject: Question about chroot In-Reply-To: References: Sender: owner-security@freebsd.org X-Loop: FreeBSD.org Precedence: bulk < In looking at some of the "make" problems, I ran up against a > characteristic of "chroot" that puzzles me. > In order to chroot, you must be root. Why? > It appears to me than the only thing that chroot does is to restrict the > "visable" tree. It does not ADD anything that is not already there. mkdir /usr/tmp/hack mkdir /usr/tmp/hack/etc cp my-passwd-files /usr/tmp/hack/etc mkdir /usr/tmp/hack/bin cp /bin/sh /tmp/hack/bin ln /usr/bin/su /usr/tmp/hack/bin mkdir -p /usr/tmp/hack/usr/lib ln /usr/lib/* /usr/tmp/hack/lib chroot /usr/tmp/hack /bin/sh $ /bin/su Password: my-password # chmod u+s /bin/sh # ^D $ ^D /usr/tmp/hack/bin/sh # whatever-I-want -GAWollman -- Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same wollman@lcs.mit.edu | O Siem / The fires of freedom Opinions not those of| Dance in the burning flame MIT, LCS, ANA, or NSA| - Susan Aglukark and Chad Irschick