RTEMS Logo

RTEMS 4.9.3 On-Line Library


Files and Directories Manager chown - Changes the owner and/or group of a file.

PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

4.4.28: chown - Changes the owner and/or group of a file.

CALLING SEQUENCE:

#include <sys/types.h>
#include <unistd.h>

int chown(
  const char *path,
  uid_t       owner,
  gid_t       group
);

STATUS CODES:

EACCES
Search permission is denied for a directory in a file's path prefix
EINVAL
Invalid argument
ENAMETOOLONG
Length of a filename string exceeds PATH_MAX and _POSIX_NO_TRUNC is in effect.
ENOENT
A file or directory does not exist.
ENOTDIR
A component of the specified pathname was not a directory when a directory was expected.
EPERM
Operation is not permitted. Process does not have the appropriate priviledges or permissions to perform the requested operations.
EROFS
Read-only file system.

DESCRIPTION:

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.

NOTES:

This function may be restricted for some file. The pathconf function can be used to test the _PC_CHOWN_RESTRICTED flag.


PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

Copyright © 1988-2008 OAR Corporation