版權所有 © 2014 tutorialspoint
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);
如果owner或group指定為-1,則該ID不會更改。
當非超級使用者更改可執行檔案的所有者或組時,S_ISUID和S_ISGID模式位將被清除。POSIX沒有指定root執行chown()時是否也應該發生這種情況;Linux的行為取決於核心版本。對於非組可執行檔案(S_IXGRP位清除),S_ISGID位表示強制鎖定,不會被chown()清除。
只有定義_BSD_SOURCE時,才可以使用fchown()的原型。
4.4BSD版本只能由超級使用者使用(即,普通使用者無法放棄檔案)。
chmod (2)
fchownat (2)
flock (2)
path_resolution (2)
廣告