Exit from os.chroot()

support.intranet at libero.it support.intranet at libero.it
Wed Jun 4 12:40:54 EDT 2008


On 4 Giu, 17:08, Wolfgang Draxinger <wdraxin... at darkstargames.de>
wrote:
> support.intranet wrote:
> > Hello! I'm writing a small script and I need to call the
> > os.chroot function. The problem is, a few lines below I need to
> > call a program in /usr/bin. Is there a way to exit from the
> > chroot, or to limit the chroot to a single function or thread?
> > Thanks in advance
>
> No, chroot applies to the whole process and once applied it can't
> be reverted. Otherwise the whole idea of chroot being a FS jail
> would not work.
>
> So you need some programs in your chroot: Then put a directory
> usr/bin into the chroot directory and bind the system's /usr/bin
> there:
>
> mount --bind /usr/bin $chroot/usr/bin
>
> The same has to be done with all library stuff. Another option
> would be to place a statically linked busybox and it's
> subprogram links into the chroot
>
> Wolfgang Draxinger
> --
> E-Mail address works, Jabber: hexar... at jabber.org, ICQ: 134682867

Thanks! I'll try the bind way



More information about the Python-list mailing list