mirror of https://github.com/mkerrisk/man-pages
chown.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
778ac6277e
commit
009a7c83cc
40
man2/chown.2
40
man2/chown.2
|
@ -41,25 +41,23 @@ chown, fchown, lchown, fchownat \- change ownership of a file
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B #include <unistd.h>
|
.B #include <unistd.h>
|
||||||
.sp
|
.PP
|
||||||
.BI "int chown(const char *" pathname ", uid_t " owner ", gid_t " group );
|
.BI "int chown(const char *" pathname ", uid_t " owner ", gid_t " group );
|
||||||
.br
|
|
||||||
.BI "int fchown(int " fd ", uid_t " owner ", gid_t " group );
|
.BI "int fchown(int " fd ", uid_t " owner ", gid_t " group );
|
||||||
.br
|
|
||||||
.BI "int lchown(const char *" pathname ", uid_t " owner ", gid_t " group );
|
.BI "int lchown(const char *" pathname ", uid_t " owner ", gid_t " group );
|
||||||
.sp
|
|
||||||
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
|
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
|
||||||
.B #include <unistd.h>
|
.B #include <unistd.h>
|
||||||
.sp
|
.PP
|
||||||
.BI "int fchownat(int " dirfd ", const char *" pathname ,
|
.BI "int fchownat(int " dirfd ", const char *" pathname ,
|
||||||
.BI " uid_t " owner ", gid_t " group ", int " flags );
|
.BI " uid_t " owner ", gid_t " group ", int " flags );
|
||||||
.fi
|
.fi
|
||||||
.sp
|
.PP
|
||||||
.in -4n
|
.in -4n
|
||||||
Feature Test Macro Requirements for glibc (see
|
Feature Test Macro Requirements for glibc (see
|
||||||
.BR feature_test_macros (7)):
|
.BR feature_test_macros (7)):
|
||||||
.in
|
.in
|
||||||
.sp
|
.PP
|
||||||
.BR fchown (),
|
.BR fchown (),
|
||||||
.BR lchown ():
|
.BR lchown ():
|
||||||
.PD 0
|
.PD 0
|
||||||
|
@ -70,7 +68,7 @@ Feature Test Macro Requirements for glibc (see
|
||||||
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
|
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
|
||||||
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE
|
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE
|
||||||
.RE
|
.RE
|
||||||
.sp
|
.PP
|
||||||
.BR fchownat ():
|
.BR fchownat ():
|
||||||
.PD 0
|
.PD 0
|
||||||
.ad l
|
.ad l
|
||||||
|
@ -115,13 +113,13 @@ to any group of which that owner is a member.
|
||||||
A privileged process (Linux: with
|
A privileged process (Linux: with
|
||||||
.BR CAP_CHOWN )
|
.BR CAP_CHOWN )
|
||||||
may change the group arbitrarily.
|
may change the group arbitrarily.
|
||||||
|
.PP
|
||||||
If the
|
If the
|
||||||
.I owner
|
.I owner
|
||||||
or
|
or
|
||||||
.I group
|
.I group
|
||||||
is specified as \-1, then that ID is not changed.
|
is specified as \-1, then that ID is not changed.
|
||||||
|
.PP
|
||||||
When the owner or group of an executable file is
|
When the owner or group of an executable file is
|
||||||
changed by an unprivileged user, the
|
changed by an unprivileged user, the
|
||||||
.B S_ISUID
|
.B S_ISUID
|
||||||
|
@ -142,7 +140,7 @@ bit is not set) the
|
||||||
.B S_ISGID
|
.B S_ISGID
|
||||||
bit indicates mandatory locking, and is not cleared by a
|
bit indicates mandatory locking, and is not cleared by a
|
||||||
.BR chown ().
|
.BR chown ().
|
||||||
|
.PP
|
||||||
When the owner or group of an executable file is changed (by any user),
|
When the owner or group of an executable file is changed (by any user),
|
||||||
all capability sets for the file are cleared.
|
all capability sets for the file are cleared.
|
||||||
.\"
|
.\"
|
||||||
|
@ -152,7 +150,7 @@ The
|
||||||
system call operates in exactly the same way as
|
system call operates in exactly the same way as
|
||||||
.BR chown (),
|
.BR chown (),
|
||||||
except for the differences described here.
|
except for the differences described here.
|
||||||
|
.PP
|
||||||
If the pathname given in
|
If the pathname given in
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative, then it is interpreted relative to the directory
|
is relative, then it is interpreted relative to the directory
|
||||||
|
@ -162,7 +160,7 @@ referred to by the file descriptor
|
||||||
the calling process, as is done by
|
the calling process, as is done by
|
||||||
.BR chown ()
|
.BR chown ()
|
||||||
for a relative pathname).
|
for a relative pathname).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is relative and
|
is relative and
|
||||||
|
@ -174,13 +172,13 @@ then
|
||||||
is interpreted relative to the current working
|
is interpreted relative to the current working
|
||||||
directory of the calling process (like
|
directory of the calling process (like
|
||||||
.BR chown ()).
|
.BR chown ()).
|
||||||
|
.PP
|
||||||
If
|
If
|
||||||
.I pathname
|
.I pathname
|
||||||
is absolute, then
|
is absolute, then
|
||||||
.I dirfd
|
.I dirfd
|
||||||
is ignored.
|
is ignored.
|
||||||
|
.PP
|
||||||
The
|
The
|
||||||
.I flags
|
.I flags
|
||||||
argument is a bit mask created by ORing together
|
argument is a bit mask created by ORing together
|
||||||
|
@ -232,7 +230,7 @@ is set appropriately.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
Depending on the filesystem,
|
Depending on the filesystem,
|
||||||
errors other than those listed below can be returned.
|
errors other than those listed below can be returned.
|
||||||
|
.PP
|
||||||
The more general errors for
|
The more general errors for
|
||||||
.BR chown ()
|
.BR chown ()
|
||||||
are listed below.
|
are listed below.
|
||||||
|
@ -324,7 +322,7 @@ library support was added to glibc in version 2.4.
|
||||||
.BR fchown (),
|
.BR fchown (),
|
||||||
.BR lchown ():
|
.BR lchown ():
|
||||||
4.4BSD, SVr4, POSIX.1-2001, POSIX.1-2008.
|
4.4BSD, SVr4, POSIX.1-2001, POSIX.1-2008.
|
||||||
|
.PP
|
||||||
The 4.4BSD version can be
|
The 4.4BSD version can be
|
||||||
used only by the superuser (that is, ordinary users cannot give away files).
|
used only by the superuser (that is, ordinary users cannot give away files).
|
||||||
.\" chown():
|
.\" chown():
|
||||||
|
@ -333,7 +331,7 @@ used only by the superuser (that is, ordinary users cannot give away files).
|
||||||
.\" fchown():
|
.\" fchown():
|
||||||
.\" SVr4 documents additional EINVAL, EIO, EINTR, and ENOLINK
|
.\" SVr4 documents additional EINVAL, EIO, EINTR, and ENOLINK
|
||||||
.\" error conditions.
|
.\" error conditions.
|
||||||
|
.PP
|
||||||
.BR fchownat ():
|
.BR fchownat ():
|
||||||
POSIX.1-2008.
|
POSIX.1-2008.
|
||||||
.SH NOTES
|
.SH NOTES
|
||||||
|
@ -433,7 +431,7 @@ The glibc
|
||||||
and
|
and
|
||||||
.BR lchown ()
|
.BR lchown ()
|
||||||
wrapper functions transparently deal with the variations across kernel versions.
|
wrapper functions transparently deal with the variations across kernel versions.
|
||||||
|
.PP
|
||||||
In versions of Linux prior to 2.1.81 (and distinct from 2.1.46),
|
In versions of Linux prior to 2.1.81 (and distinct from 2.1.46),
|
||||||
.BR chown ()
|
.BR chown ()
|
||||||
did not follow symbolic links.
|
did not follow symbolic links.
|
||||||
|
@ -458,7 +456,7 @@ or as a username (which is converted to a user ID by using
|
||||||
.BR getpwnam (3)
|
.BR getpwnam (3)
|
||||||
to perform a lookup in the system password file).
|
to perform a lookup in the system password file).
|
||||||
.SS Program source
|
.SS Program source
|
||||||
.nf
|
.EX
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -495,7 +493,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
.fi
|
.EE
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR chgrp (1),
|
.BR chgrp (1),
|
||||||
.BR chown (1),
|
.BR chown (1),
|
||||||
|
|
Loading…
Reference in New Issue