Penguin
Annotated edit history of chmod(2) version 4, including all changes. View license author blame.
Rev Author # Line
1 perry 1 CHMOD
2 !!!CHMOD
3 ----
4 !!NAME
5
6
2 PerryLorier 7 chmod - change permissions of a file
1 perry 8 !!SYNOPSIS
9
2 PerryLorier 10 __#include <sys/types.h>__
11 __#include <sys/stat.h>__
1 perry 12
2 PerryLorier 13 __int chmod(const char *__''path''__, mode_t__ ''mode''__);__
1 perry 14 !!DESCRIPTION
15
2 PerryLorier 16 The mode of the file given by ''path'' is changed.
1 perry 17
2 PerryLorier 18 Modes are specified by ''or'ing'' the following:
3 PerryLorier 19 |S_ISUID| 04000| set user ID on execution
20 |S_ISGID| 02000| set group ID on execution
21 |S_ISVTX| 01000| sticky bit
4 PerryLorier 22 |S_IRUSR (S_IREAD)| 00400| read by owner
23 |S_IWUSR (S_IWRITE)| 00200| write by owner
24 |S_IXUSR (S_IEXEC)| 00100| execute/search by owner
3 PerryLorier 25 |S_IRGRP| 00040| read by group
26 |S_IWGRP| 00020| write by group
27 |S_IXGRP| 00010| execute/search by group
28 |S_IROTH| 00004| read by others
29 |S_IWOTH| 00002| write by others
30 |S_IXOTH| 00001| execute/search by others
4 PerryLorier 31
1 perry 32
2 PerryLorier 33 The effective UID of the process must be zero or must match the owner of the file.
1 perry 34
2 PerryLorier 35 If the effective UID of the process is not zero and the group of the file does not match the effective group ID of the process or one of its supplementary group IDs, the S_ISGID bit will be turned off, but this will not cause an error to be returned.
1 perry 36
2 PerryLorier 37 Depending on the file system, set user ID and set group ID execution bits may be turned off if a file is written. On some file systems, only the super-user can set the sticky bit, which may have a special meaning. For the sticky bit, and for set user ID and set group ID bits on directories, see stat(2).
1 perry 38
2 PerryLorier 39 On NFS file systems, restricting the permissions will immediately influence already open files, because the access control is done on the server, but open files are maintained by the client. Widening the permissions may be delayed for other clients if attribute caching is enabled on them.
1 perry 40
41 !!RETURN VALUE
2 PerryLorier 42 On success, zero is returned. On error, -1 is returned, and ''errno'' is set appropriately.
1 perry 43
44 !!ERRORS
45
46 Depending on the file system, other errors can be returned.
47 The more general errors for __chmod__ are listed
48 below:
2 PerryLorier 49 ;[EPERM]: The effective UID does not match the owner of the file, and is not zero.
50 ;[EROFS]: The named file resides on a read-only file system.
51 ;[EFAULT]: ''path'' points outside your accessible address space.
52 ;[ENAMETOOLONG]: ''path'' is too long.
53 ;[ENOENT]: The file does not exist.
54 ;[ENOMEM]: Insufficient kernel memory was available.
55 ;[ENOTDIR]: A component of the path prefix is not a directory.
56 ;[EACCES]: Search permission is denied on a component of the path prefix.
57 ;[ELOOP]: Too many symbolic links were encountered in resolving ''path''.
58 ;[EIO]: An I/O error occurred.
1 perry 59
60 !!CONFORMING TO
61
2 PerryLorier 62 The __chmod__ call conforms to SVr4, SVID, POSIX, X/OPEN, 4.4BSD. SVr4 documents EINTR, ENOLINK and EMULTIHOP returns, but no ENOMEM. POSIX.1 does not document EFAULT, ENOMEM, ELOOP or EIO error conditions, or the macros __S_IREAD__, __S_IWRITE__ and __S_IEXEC__.
1 perry 63
2 PerryLorier 64 POSIX and X/OPEN do not document the sticky bit.
1 perry 65 !!SEE ALSO
66
2 PerryLorier 67 open(2), chown(2), execve(2), stat(2)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 5 times)