- path
- Documentation for this section has not yet been entered.
- owner
- Documentation for this section has not yet been entered.
- group
- Documentation for this section has not yet been entered.
On success, zero is returned. On error, -1 is returned and Stdlib.GetLastError returns the translated error.
Usage
The chown() and lchown() will fail and the file will be unchanged if:
Error Details Errno.ENOTDIR A component of the path prefix is not a directory.
Errno.ENAMETOOLONG A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
Errno.ENOENT The named file does not exist.
Errno.EACCES Search permission is denied for a component of the path prefix.
Errno.ELOOP Too many symbolic links were encountered in translating the pathname.
Errno.EPERM The effective user ID is not the super-user.
Errno.EROFS The named file resides on a read-only file system.
Errno.EFAULT The path argument points outside the process's allocated address space.
Errno.EIO An I/O error occurred while reading from or writing to the file system.
The fchown() system call will fail if:
Error Details Errno.EBADF The fd argument does not refer to a valid descriptor.
Errno.EINVAL The fd argument refers to a socket, not a file.
Errno.EPERM The effective user ID is not the super-user.
Errno.EROFS The named file resides on a read-only file system.
Errno.EIO An I/O error occurred while reading from or writing to the file system.
The owner ID and group ID of the file named by path or referenced by fd is changed as specified by the arguments owner and group . The owner of a file may change the group to a group of which he or she is a member, but the change owner capability is restricted to the super-user.
The chown() system call clears the set-user-id and set-group-id bits on the file to prevent accidental or mischievous creation of set-user-id and set-group-id programs if not executed by the super-user. The chown() system call follows symbolic links to operate on the target of the link rather than the link itself.
The fchown() system call is particularly useful when used in conjunction with the file locking primitives (see Syscall.flock(2) ) .
The lchown() system call is similar to chown() but does not follow symbolic links.
One of the owner or group id's may be left unchanged by specifying it as -1.