import os
path = "./file.txt"
symlink = "./file(symlink).txt"
os.symlink(path, symlink)
fd = os.open(symlink, os.O_RDWR)
print("Owner id of the file:", os.stat(path).st_uid)
print("Group id of the file:", os.stat(path).st_gid)
print("Owner id of the symlink:", os.stat(symlink).st_uid)
print("Group id of the symlink:", os.stat(symlink).st_gid)
uid = 600
gid = 700
os.fchown(fd, uid, gid)
print("\nOwner id and group id changed")
print("\nOwner id of the file:", os.stat(path).st_uid)
print("Group id of the file:", os.stat(path).st_gid)
print("Owner id of the symlink:", os.stat(symlink).st_uid)
print("Group id of the symlink:", os.stat(symlink).st_gid)