os.chown()

os.chown(path, uid, gid)

Change the owner and group id of path to the numeric uid and gid.