You are here : python_2ososchroot

os.chroot() - os

             

The method chroot() changes the root directory of the current process to the given path.To use this method, you would need super user privilege.


  • path -- This is the path which would be set as root for the current process.


Syntax


os.chroot(path);


Example


#!/usr/bin/python

import os, sys

# To set the current root path to /tmp/user

os.chroot("/tmp/usr")

print "Changed root path successfully!!"


Output / Return Value

When we run above program, it produces following result:


Changed root path successfully!!


Limitations


Alternatives / See Also


Reference