os.fchown()

os.fchown(fd, uid, gid)

Change the owner and group id of the file given by file descriptor fd to the numeric uid and gid.