Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/man/man2/chown.2
Real path: /usr/share/man/man2/chown.2
Zurück
'\" te .\" Copyright (c) 2003, 2022, Oracle and/or its affiliates. .\" Copyright (c) 1989, AT&T. All rights reserved. .TH chown 2 "2 Jun 2022" "Oracle Solaris 11.4" "System Calls" .SH NAME chown, lchown, fchown, fchownat \- change owner and group of a file .SH SYNOPSIS .LP .nf #include <unistd.h> #include <sys/types.h> \fBint\fR \fBchown\fR(\fBconst char *\fR\fIpath\fR, \fBuid_t\fR \fIowner\fR, \fBgid_t\fR \fIgroup\fR); .fi .LP .nf \fBint\fR \fBlchown\fR(\fBconst char *\fR\fIpath\fR, \fBuid_t\fR \fIowner\fR, \fBgid_t\fR \fIgroup\fR); .fi .LP .nf \fBint\fR \fBfchown\fR(\fBint\fR \fIfildes\fR, \fBuid_t\fR \fIowner\fR, \fBgid_t\fR \fIgroup\fR); .fi .LP .nf \fBint\fR \fBfchownat\fR(\fBint\fR \fIfildes\fR, \fBconst char *\fR\fIpath\fR, \fBuid_t\fR \fIowner\fR, \fBgid_t\fR \fIgroup\fR, \fBint\fR \fIflag\fR); .fi .SH DESCRIPTION .sp .LP The \fBchown()\fR and \fBfchown()\fR functions set the owner \fBID\fR and group \fBID\fR of the file specified by \fIpath\fR or referenced by the open file descriptor \fIfildes\fR to \fIowner\fR and \fIgroup\fR respectively. If \fIowner\fR or \fIgroup\fR is specified as \(mi1, these functions do not change the corresponding \fBID\fR of the file. .sp .LP The \fBlchown()\fR function sets the owner \fBID\fR and group \fBID\fR of the named file in the same manner as \fBchown()\fR, unless the named file is a symbolic link. In this case, \fBlchown()\fR changes the ownership of the symbolic link file itself, while \fBchown()\fR changes the ownership of the file or directory to which the symbolic link refers. .sp .LP The \fBfchownat()\fR function sets the owner ID and group ID of the named file in the same manner as \fBchown()\fR. If, however, the \fIpath\fR argument is relative, the path is resolved relative to the \fIfildes\fR argument rather than the current working directory. If the \fIfildes\fR argument has the special value \fBAT_FDCWD\fR, the path resolution reverts back to current working directory relative. If the \fIpath\fR argument is absolute, the \fIfildes\fR argument is ignored. If the \fIpath\fR argument is a null pointer, the function behaves like \fBfchown()\fR. .sp .LP Values for \fIflag\fR are constructed by a bitwise-inclusive OR of flags from the following list, defined in \fB<fcntl.h>\fR: .sp .ne 2 .mk .na \fB\fBAT_SYMLINK_NOFOLLOW\fR\fR .ad .RS 23n .rt If \fIpath\fR names a symbolic link, then ownership of the symbolic link is changed, as in \fBlchown()\fR. .RE .sp .LP If \fBchown()\fR, \fBlchown()\fR, \fBfchown()\fR, or \fBfchownat()\fR is invoked by a process that does not have {\fBPRIV_FILE_SETID\fR} asserted in its effective set, the set-user-ID and set-group-ID bits of the file mode, \fBS_ISUID\fR and \fBS_ISGID\fR respectively, are cleared (see \fBchmod\fR(2)). Additional restrictions apply when changing the ownership to uid 0. .sp .LP The operating system defines several privileges to override restrictions on the \fBchown()\fR family of functions. When the {\fBPRIV_FILE_CHOWN\fR} privilege is asserted in the effective set of the current process, there are no restrictions except in the special circumstances of changing ownership to or from uid 0. When the {\fBPRIV_FILE_CHOWN_SELF\fR} privilege is asserted, ownership changes are restricted to the files of which the ownership matches the effective user ID of the current process. If neither privilege is asserted in the effective set of the calling process, ownership changes are limited to changes of the group of the file to the list of supplementary group IDs and the effective group ID. .sp .LP The file system provides mount options \fBrstchown\fR and \fBnorstchown\fR to control the default \fBchown()\fR behavior of the file system and NFS server. If \fBrstchown\fR is not in effect, the privilege {\fBPRIV_FILE_CHOWN_SELF\fR} is implicitly granted to the user when attempting to give away files, except for files owned by \fBuid\fR 0. The \fB_POSIX_CHOWN_RESTRICTED\fR option will be reported as true for paths on filesystems mounted with the \fBrstchown\fR option, when checked with \fBfpathconf\fR(2) or \fBgetconf\fR(1). .sp .LP Upon successful completion, \fBchown()\fR, \fBfchown()\fR, \fBfchownat()\fR, and \fBlchown()\fR mark for update the \fBst_ctime\fR field of the file. .SH RETURN VALUES .sp .LP Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is returned, the owner and group of the named file remain unchanged, and \fBerrno\fR is set to indicate the error. .SH ERRORS .sp .LP All of these functions will fail if: .sp .ne 2 .mk .na \fB\fBEPERM\fR\fR .ad .RS 9n .rt The effective user ID does not match the owner of the file and the {\fBPRIV_FILE_CHOWN\fR} privilege is not asserted in the effective set of the calling process, or the {\fBPRIV_FILE_CHOWN_SELF\fR} privilege is not asserted in the effective set of the calling process. .sp The file has one or more of the \fBimmutable\fR or \fBrtime\fR system attributes set. .RE .sp .LP The \fBchown()\fR, \fBlchown()\fR, and \fBfchownat()\fR functions will fail if: .sp .ne 2 .mk .na \fB\fBEACCES\fR\fR .ad .RS 16n .rt Search permission is denied on a component of the path prefix of \fIpath\fR. .RE .sp .ne 2 .mk .na \fB\fBEFAULT\fR\fR .ad .RS 16n .rt The \fIpath\fR argument points to an illegal address and for \fBfchownat()\fR, the file descriptor has the value \fBAT_FDCWD\fR. .RE .sp .ne 2 .mk .na \fB\fBEINTR\fR\fR .ad .RS 16n .rt A signal was caught during the execution of the \fBchown()\fR or \fBlchown()\fR function. .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 16n .rt The \fIgroup\fR or \fIowner\fR argument is out of range. .RE .sp .ne 2 .mk .na \fB\fBEIO\fR\fR .ad .RS 16n .rt An I/O error occurred while reading from or writing to the file system. .RE .sp .ne 2 .mk .na \fB\fBELOOP\fR\fR .ad .RS 16n .rt Too many symbolic links were encountered in translating \fIpath\fR. .RE .sp .ne 2 .mk .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n .rt The length of the \fIpath\fR argument exceeds {\fIPATH_MAX\fR}, or the length of a \fIpath\fR component exceeds {\fINAME_MAX\fR} while {\fB_POSIX_NO_TRUNC\fR} is in effect. .RE .sp .ne 2 .mk .na \fB\fBENOLINK\fR\fR .ad .RS 16n .rt The \fIpath\fR argument points to a remote machine and the link to that machine is no longer active. .RE .sp .ne 2 .mk .na \fB\fBENOENT\fR\fR .ad .RS 16n .rt Either a component of the path prefix or the file referred to by \fIpath\fR does not exist or is a null pathname. .RE .sp .ne 2 .mk .na \fB\fBENOTDIR\fR\fR .ad .RS 16n .rt A component of the path prefix of \fIpath\fR is not a directory, or the path supplied to \fBfchownat()\fR is relative and the file descriptor provided does not refer to a valid directory. .RE .sp .ne 2 .mk .na \fB\fBEROFS\fR\fR .ad .RS 16n .rt The named file resides on a read-only file system. .RE .sp .LP The \fBfchown()\fR and \fBfchownat()\fR functions will fail if: .sp .ne 2 .mk .na \fB\fBEBADF\fR\fR .ad .RS 11n .rt For \fBfchown()\fR the \fIfildes\fR argument is not an open file descriptor and. .sp For \fBfchownat()\fR, the \fIpath\fR argument is not absolute and the \fIfildes\fR argument is not \fBAT_FDCWD\fR or an open file descriptor. .RE .sp .ne 2 .mk .na \fB\fBEIO\fR\fR .ad .RS 11n .rt An I/O error occurred while reading from or writing to the file system. .RE .sp .ne 2 .mk .na \fB\fBEINTR\fR\fR .ad .RS 11n .rt A signal was caught during execution of the function. .RE .sp .ne 2 .mk .na \fB\fBENOLINK\fR\fR .ad .RS 11n .rt The \fIfildes\fR argument points to a remote machine and the link to that machine is no longer active. .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 11n .rt The \fIgroup\fR or \fIowner\fR argument is out of range. .RE .sp .ne 2 .mk .na \fB\fBEROFS\fR\fR .ad .RS 11n .rt The named file referred to by \fIfildes\fR resides on a read-only file system. .RE .SH USAGE .sp .LP The ability to specify a null \fIpath\fR argument to the \fBfchownat()\fR function is a Solaris extension not specified by the standards, and may not be portable to other systems. Use the \fBfchown()\fR function for greater portability when changing the ownership of an open file descriptor. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level Async-Signal-Safe _ Standard See below. .TE .sp .sp .LP See \fBstandards\fR(7) for descriptions of the following standards: .sp .TS tab( ) box; cw(2.2i) |cw(3.3i) lw(2.2i) |lw(3.3i) . INTERFACES APPLICABLE STANDARDS _ .br .in +2 \fBchown()\fR .in -2 T{ .br .in +2 POSIX.1-1990 through 2008, .in -2 .br .in +2 SUS through SUSv4, .in -2 .br .in +2 XPG1 through XPG7 .in -2 T} _ T{ .br .in +2 \fBfchown()\fR .in -2 .br .in +2 \fBlchown()\fR .in -2 T} T{ .br .in +2 POSIX.1-2001 through 2008, .in -2 .br .in +2 SUS through SUSv4, .in -2 .br .in +2 XPG4v2 through XPG7 .in -2 T} _ .br .in +2 \fBfchownat()\fR .in -2 T{ .br .in +2 POSIX.1-2008, .in -2 .br .in +2 SUSv4, .in -2 .br .in +2 XPG7 .in -2 T} .TE .sp .SH SEE ALSO .sp .LP \fBchgrp\fR(1), \fBchown\fR(1), \fBgetconf\fR(1), \fBchmod\fR(2), \fBfpathconf\fR(2), \fBsystem\fR(5), \fBattributes\fR(7), \fBprivileges\fR(7), \fBstandards\fR(7), \fBsysattr\fR(7) .SH HISTORY .sp .LP The \fBchown()\fR, \fBfchown()\fR, and \fBlchown()\fR functions have been included in all Sun and Oracle releases of Solaris. .sp .LP The \fBfchownat()\fR function was added to Solaris in the Solaris 9 release.