Open System Services System Calls Reference Manual (G06.28+, H06.05+)
System Functions (a - d) chown(2)
NAME
chown - Changes the owner and group IDs of a file
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <unistd.h>
int chown(
const char *path,
uid_t owner,
gid_t group);
PARAMETERS
path Specifies the name of the file whose owner ID, group ID, or both are to be
changed. If the final component of the path parameter names a symbolic link,
the link is traversed, and pathname resolution continues.
When the path parameter refers to a symbolic link, the chown() function
changes the ownership of the file pointed to by the symbolic link.
owner Specifies a numeric value representing the owner ID.
group Specifies a numeric value representing the group ID.
DESCRIPTION
The chown() function changes the owner and group of a file.
Only a process that has an effective user ID equal to the super ID or to the file owner, or that has |
an effective user ID or group affiliation qualifying for membership in the Safeguard |
SECURITY-OSS-ADMINISTRATOR group can use the chown() function to change the group |
of a file. However, processes that have an effective user ID equal to the file owner can only |
change the group of a file to a group to which they belong (their effective group or one of their |
supplementary groups). |
If the chown() function is invoked by a process whose effective user ID does not equal the super |
ID, the set-user-ID and set-group-ID bits of the file mode (04000 and 02000, respectively) are |
cleared.
If the chown() function is successfully invoked on a file, the S_ISGID and S_ISUID bits of the
st_mode field of the stat structure are cleared unless the user has appropriate privileges.
The _POSIX_CHOWN_RESTRICTED feature is enforced for any file in the OSS file system.
Only processes with appropriate privileges can change owner IDs.
If the owner or group parameter is specified as -1 cast to the type of uid_t or gid_t, respectively,
the corresponding ID of the file is unchanged. To change only one attribute, specify the other as
-1.
Upon successful completion, the chown() function marks the st_ctime field of the file for update.
527186-007 Hewlett-Packard Company 1−25