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
|
||||
.\" 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
|
||||
chmod, fchmod \- change permissions of a file
|
||||
.SH SYNOPSIS
|
||||
|
@ -46,54 +46,68 @@ Feature Test Macro Requirements for glibc (see
|
|||
.BR fchmod ():
|
||||
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
|
||||
.SH DESCRIPTION
|
||||
.\" FIXME . The description here could be improved.
|
||||
The mode of the file given by
|
||||
.I path
|
||||
or referenced by
|
||||
.I fd
|
||||
is changed.
|
||||
|
||||
Modes are specified by
|
||||
.I or'ing
|
||||
the following:
|
||||
.RS
|
||||
.TP 1.0i
|
||||
.B S_ISUID
|
||||
04000 set user ID on execution
|
||||
These system calls change the permissions of a file.
|
||||
They differ only in how the file is specified:
|
||||
.IP * 2
|
||||
.BR chmod ()
|
||||
changes the permissions of the file specified whose pathname is given in
|
||||
.IR path ,
|
||||
which is dereferenced if it is a symbolic link.
|
||||
.IP *
|
||||
.BR fchmod ()
|
||||
changes the permissions of the file referred to by the open file descriptor
|
||||
.IR fd .
|
||||
.PP
|
||||
The new file permissions are specified in
|
||||
.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
|
||||
.B S_ISGID
|
||||
02000 set group ID on execution
|
||||
.BR S_ISGID " (02000)"
|
||||
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
|
||||
.B S_ISVTX
|
||||
01000 sticky bit
|
||||
.BR S_ISVTX " (01000)"
|
||||
sticky bit (restricted deletion flag, as described in
|
||||
.BR unlink (2))
|
||||
.TP
|
||||
.B S_IRUSR
|
||||
00400 read by owner
|
||||
.BR S_IRUSR " (00400)"
|
||||
read by owner
|
||||
.TP
|
||||
.B S_IWUSR
|
||||
00200 write by owner
|
||||
.BR S_IWUSR " (00200)"
|
||||
write by owner
|
||||
.TP
|
||||
.B S_IXUSR
|
||||
00100 execute/search by owner
|
||||
.BR S_IXUSR " (00100)"
|
||||
execute/search by owner ("search" applies for directories,
|
||||
and means that entries within the directory can be accessed)
|
||||
.TP
|
||||
.B S_IRGRP
|
||||
00040 read by group
|
||||
.BR S_IRGRP " (00040)"
|
||||
read by group
|
||||
.TP
|
||||
.B S_IWGRP
|
||||
00020 write by group
|
||||
.BR S_IWGRP " (00020)"
|
||||
write by group
|
||||
.TP
|
||||
.B S_IXGRP
|
||||
00010 execute/search by group
|
||||
.BR S_IXGRP " (00010)"
|
||||
execute/search by group
|
||||
.TP
|
||||
.B S_IROTH
|
||||
00004 read by others
|
||||
.BR S_IROTH " (00004)"
|
||||
read by others
|
||||
.TP
|
||||
.B S_IWOTH
|
||||
00002 write by others
|
||||
.BR S_IWOTH " (00002)"
|
||||
write by others
|
||||
.TP
|
||||
.B S_IXOTH
|
||||
00001 execute/search by others
|
||||
.RE
|
||||
.BR S_IXOTH " (00001)"
|
||||
execute/search by others
|
||||
.PP
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue