Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (a - d) chmod(2)
NAME
chmod - Changes file-access permissions
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series and J-series native Guardian processes: implicit libraries
H-series and J-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <sys/stat.h>
int chmod(
const char *path,
mode_t mode);
PARAMETERS
path Specifies the full pathname of the file. If the path parameter refers to a symbolic
link, the chmod() function changes access permissions on the file specified by
the symbolic link.
mode Specifies the bit pattern that determines the access permissions.
DESCRIPTION
The chmod() function sets the access permissions of the file specified by the path parameter
according to the bit pattern specified by the mode parameter.
To change the file access permissions of a file or directory, the effective user ID of the process
must match the super ID or the owner of the file, or its effective user ID or one of its group
affiliations must qualify it for membership in the Safeguard SECURITY-OSS-
ADMINISTRATOR group.
If chmod() is invoked by a process whose effective user ID does not equal the super ID or file
owner, the set-user-ID and set-group-ID bits of the file mode (04000 and 02000, respectively) are
cleared.
If chmod() is invoked to set either or both of the set-user-ID and set-group-ID bits of the file
mode (04000 and 02000 respectively), then any file privileges the file might have had are
cleared.
See also "Accessing Files in Restricted-Access Filesets."
If the S_ISVTX bit is on for a directory, only processes with an effective user ID equal to the
user ID of the file’s owner or the directory’s owner, or a process with appropriate privileges, can
remove files from the directory.
A call to the chmod() function has no effect on the file descriptor for a file that is open at the
time of the call. However, new openers of the file will be authorized by using the new access per-
missions that were specified in the call.
The mode parameter is constructed by logically ORing one or more of these symbols, which are
defined in the sys/stat.h header file:
S_ISUID Sets the process’s effective user ID to the user ID of the file’s owner on execu-
tion.
527186-023 Hewlett-Packard Company 1−21