#include <sys/types.h> #include <unistd.h> int chown( const char *path, uid_t owner, gid_t group );
The user ID and group ID of the file named by path
are set to
owner
and path
, respectively.
For regular files, the set group ID (S_ISGID) and set user ID (S_ISUID) bits are cleared.
Some systems consider it a security violation to allow the owner of a file to
be changed, If users are billed for disk space usage, loaning a file to
another user could result in incorrect billing. The chown()
function
may be restricted to privileged users for some or all files. The group ID can
still be changed to one of the supplementary group IDs.
This function may be restricted for some file. The pathconf
function
can be used to test the _PC_CHOWN_RESTRICTED
flag.
Copyright © 1988-2004 OAR Corporation