#include <unistd.h>
int chown(const char *path, uid_t owner, gid_t group);
int fchown(int fd, uid_t owner, gid_t group);
int lchown(const char *path, uid_t owner, gid_t group);
实际执行需要root权限。也就是使用root身份或者sudo来运行该程序的可执行文件。
If the owner or group is specified as -1, then that ID is not changed.