Expected bahaviour of os.chroot and os.getcwd

Ian Kelly ian.g.kelly at gmail.com
Mon Sep 13 20:38:55 CEST 2010

On Mon, Sep 13, 2010 at 12:04 PM, r0g <aioe.org at technicalbloke.com> wrote:

> i.e. So do I always have to change directory after changing into a chroot?

Yes, as documented in the man page for the chroot system call:

This call changes an ingredient in the pathname resolution process and does
> nothing else.
> This call does not change the current working directory, so that after the
> call '.' can be outside the tree rooted at '/'. In particular, the superuser
> can escape from a 'chroot jail' by doing 'mkdir foo; chroot foo; cd ..'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100913/6c860e8d/attachment.html>

More information about the Python-list mailing list