def chown(path, filename): """Set owner and group of file to that of the parent directory.""" s = os.stat(path) os.chown(os.path.join(path, filename), s.st_uid, s.st_gid)