In a hurry, are you? First of all, to change permissions on file owned by root, your code needs to be root. Second, the methods you are looking for are os.chown() (for changing owner, if you need to) and os.chmod() (for changing permissions). The library reference is your friend: http://docs.python.org/library/os.html So, to change the permission: Code: import os import stat os.chmod('/your/file', stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH) (See the documentation of stat module for more info about the flags)
import os import stat os.chmod('/your/file', stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)