diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-26 16:38:00 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-26 16:38:00 -0400 |
| commit | 97d5c458cfa039d857301e1ca7d5af3beb37131d (patch) | |
| tree | b460cd850d0537eb71806ba30358840377b27688 /static/unix-v10/man2/chown.2 | |
| parent | b89dc2331a50c63f8b33272a5c4c61ab98abdaa3 (diff) | |
build: Better Build System
Diffstat (limited to 'static/unix-v10/man2/chown.2')
| -rw-r--r-- | static/unix-v10/man2/chown.2 | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/static/unix-v10/man2/chown.2 b/static/unix-v10/man2/chown.2 new file mode 100644 index 00000000..68b7ed52 --- /dev/null +++ b/static/unix-v10/man2/chown.2 @@ -0,0 +1,71 @@ +.TH CHOWN 2 +.CT 2 file_inq_creat dirs secur +.SH NAME +chown, fchown \(mi change owner and group of a file +.SH SYNOPSIS +.nf +.B int chown(name, owner, group) +.B char *name; +.PP +.B int fchown(fd, owner, group) +.fi +.SH DESCRIPTION +.I Chown +changes the +.I owner +and +.I group +of the file specified by the null-terminated string +.IR name . +.I Fchown +changes the owner and group of an open file +specified by file descriptor. +Only the super-user may +change the userid of a file. +The owner of a file +may change its groupid +to match the current effective groupid; +any other changes +are restricted to the super-user. +If the file has either +set-userid or set-groupid permission (see +.IR stat (2)) +neither the userid or groupid may be changed. +.SH EXAMPLES +The following sequence, executed by a superuser process with +.BR T_NOCHK +and +.B T_SETPRIV +capabilities, will change the owner of any file, regardless of +privileges and set-id modes +(less Herculean methods usually suffice). +The sequence is illustrative only: it ignores the +possiblility of the file being altered by a hostile superuser +while the file is unprivileged. +Sound security procedures might require the various steps to be done by +different persons, with interspersed vetting similar to that described in +.IR setpriv (8). +.IP +.EX +getflab(file, &savlab); +setflab(file, &nopriv); +stat(file, &savmod); +chmod(file, 0); +chown(file, uid, gid); +chmod(file, savmod.s_mode); +setflab(file, &savlab); +.EE +.SH "SEE ALSO" +.IR chown (8), +.IR chmod (2), +.IR passwd (5) +.SH DIAGNOSTICS +.BR EACCES , +.BR EBADF , +.BR EFAULT , +.BR EIO , +.BR ELAB , +.BR ELOOP , +.BR ENOENT , +.BR ENOTDIR , +.BR EPERM |
