Date: Thu, 29 May 1997 17:36:05 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: julian@whistle.com (Julian Elischer) Cc: imp@village.org, terry@lambert.org, dec@phoenix.its.rpi.edu, peter@grendel.IAEhv.nl, mrcpu@cdsnet.net, hackers@FreeBSD.ORG Subject: Re: Correct way to chroot for shell account users? Message-ID: <199705300036.RAA05616@phaeton.artisoft.com> In-Reply-To: <338E1C3B.2781E494@whistle.com> from "Julian Elischer" at May 29, 97 05:15:55 pm
next in thread | previous in thread | raw e-mail | index | archive | help
It won't work for arbitrary depth without modification...
main()
{
dev_t d_last;
ino_t i_last;
struct stat sb;
mkdir( "xxx");
chroot("xxx");
chdir("..");
stat( ".", &sb);
do {
d_last = sb.st_dev;
i_last = sb.st_ino;
if (chdir(".."))
break;
stat( ".", &sb);
} while( sb.st_dev != d_last || sb.st_ino != i_last);
chroot(".");
}
Now *there's* a reliable hack... 8-).
Terry Lambert
terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705300036.RAA05616>
