mirror of https://github.com/mkerrisk/man-pages
Clarify description of chmod() and fchmod().
Add further detail on S_ISUID, S_ISGID, and S_ISVTX permissions. Reformat list of permissions bits.
This commit is contained in:
parent
94b40171e1
commit
0689a4da14
90
man2/chmod.2
90
man2/chmod.2
|
@ -28,7 +28,7 @@
|
||||||
.\" <michael@cantor.informatik.rwth-aachen.de>: NFS details
|
.\" <michael@cantor.informatik.rwth-aachen.de>: NFS details
|
||||||
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
|
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
|
||||||
.\"
|
.\"
|
||||||
.TH CHMOD 2 2007-07-26 "Linux" "Linux Programmer's Manual"
|
.TH CHMOD 2 2008-05-26 "Linux" "Linux Programmer's Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
chmod, fchmod \- change permissions of a file
|
chmod, fchmod \- change permissions of a file
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -46,54 +46,68 @@ Feature Test Macro Requirements for glibc (see
|
||||||
.BR fchmod ():
|
.BR fchmod ():
|
||||||
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
|
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.\" FIXME . The description here could be improved.
|
These system calls change the permissions of a file.
|
||||||
The mode of the file given by
|
They differ only in how the file is specified:
|
||||||
.I path
|
.IP * 2
|
||||||
or referenced by
|
.BR chmod ()
|
||||||
.I fd
|
changes the permissions of the file specified whose pathname is given in
|
||||||
is changed.
|
.IR path ,
|
||||||
|
which is dereferenced if it is a symbolic link.
|
||||||
Modes are specified by
|
.IP *
|
||||||
.I or'ing
|
.BR fchmod ()
|
||||||
the following:
|
changes the permissions of the file referred to by the open file descriptor
|
||||||
.RS
|
.IR fd .
|
||||||
.TP 1.0i
|
.PP
|
||||||
.B S_ISUID
|
The new file permissions are specified in
|
||||||
04000 set user ID on execution
|
.IR mode ,
|
||||||
|
which is a bit mask created by ORing together zero or
|
||||||
|
more of the following:
|
||||||
|
.TP 18
|
||||||
|
.BR S_ISUID " (04000)"
|
||||||
|
set-user-ID (set process effective user ID on
|
||||||
|
.BR execve (2))
|
||||||
.TP
|
.TP
|
||||||
.B S_ISGID
|
.BR S_ISGID " (02000)"
|
||||||
02000 set group ID on execution
|
set-group-ID (set process effective group ID on
|
||||||
|
.BR execve (2);
|
||||||
|
mandatory locking, as described in
|
||||||
|
.BR fcntl (2);
|
||||||
|
take a new file's group from parent directory, as described in
|
||||||
|
.BR chown (2)
|
||||||
|
and
|
||||||
|
.BR mkdir (2))
|
||||||
.TP
|
.TP
|
||||||
.B S_ISVTX
|
.BR S_ISVTX " (01000)"
|
||||||
01000 sticky bit
|
sticky bit (restricted deletion flag, as described in
|
||||||
|
.BR unlink (2))
|
||||||
.TP
|
.TP
|
||||||
.B S_IRUSR
|
.BR S_IRUSR " (00400)"
|
||||||
00400 read by owner
|
read by owner
|
||||||
.TP
|
.TP
|
||||||
.B S_IWUSR
|
.BR S_IWUSR " (00200)"
|
||||||
00200 write by owner
|
write by owner
|
||||||
.TP
|
.TP
|
||||||
.B S_IXUSR
|
.BR S_IXUSR " (00100)"
|
||||||
00100 execute/search by owner
|
execute/search by owner ("search" applies for directories,
|
||||||
|
and means that entries within the directory can be accessed)
|
||||||
.TP
|
.TP
|
||||||
.B S_IRGRP
|
.BR S_IRGRP " (00040)"
|
||||||
00040 read by group
|
read by group
|
||||||
.TP
|
.TP
|
||||||
.B S_IWGRP
|
.BR S_IWGRP " (00020)"
|
||||||
00020 write by group
|
write by group
|
||||||
.TP
|
.TP
|
||||||
.B S_IXGRP
|
.BR S_IXGRP " (00010)"
|
||||||
00010 execute/search by group
|
execute/search by group
|
||||||
.TP
|
.TP
|
||||||
.B S_IROTH
|
.BR S_IROTH " (00004)"
|
||||||
00004 read by others
|
read by others
|
||||||
.TP
|
.TP
|
||||||
.B S_IWOTH
|
.BR S_IWOTH " (00002)"
|
||||||
00002 write by others
|
write by others
|
||||||
.TP
|
.TP
|
||||||
.B S_IXOTH
|
.BR S_IXOTH " (00001)"
|
||||||
00001 execute/search by others
|
execute/search by others
|
||||||
.RE
|
|
||||||
.PP
|
.PP
|
||||||
The effective UID of the calling process must match the owner of the file,
|
The effective UID of the calling process must match the owner of the file,
|
||||||
or the process must be privileged (Linux: it must have the
|
or the process must be privileged (Linux: it must have the
|
||||||
|
|
Loading…
Reference in New Issue