Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fchown(2) — sys5 — Apollo Domain/OS SR10.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

access(2)

chmod(2)

chown(1)

CHOWN(2)                             SysV                             CHOWN(2)



NAME
     chown, fchown - Change the owner and group IDs of a file

SYNOPSIS
     #include <sys/types.h>

     int chown(path, owner, group )
     const char *path;
     uid_t owner;
     gid_t group ;

     int fchown(filedes, owner, group )
     int filedes;
     uid_t owner;
     gid_t group ;

DESCRIPTION
     The chown and fchown functions change the owner and group of a file.

     path specifies the name of the file whose owner ID, group ID, or both are
     to be changed.  If the path argument refers to a symbolic link, the chown
     function changes the ownership of the file pointed to by the symbolic
     link.

     filedes specifies a valid open file descriptor.

     owner specifies a numeric value representing the owner ID.

     group Specifies a numeric value representing the group ID.

     If either the node is configured to be FIPS compliant or if the program
     is compiled to be AES compliant, the following behavior is true for
     chown:

          Changing the user ID is restricted to processes with an effective
          user ID equal to ROOT (super-user) privileges.  Changing the group
          ID is permitted to a process with an effective user ID equal to the
          user ID of the file, but without super-user privileges, if and only
          if owner is equal to the file's user ID and group is equal either to
          the calling process' effective group ID or to one of its
          supplementary group IDs.

     If path refers to a regular file, the set user ID (S_ISUID) and set group
     ID (S_ISGID) bits of the file mode are cleared upon successful return
     from chown or fchown. These bits are defined in <sys/stat.h>.  For
     programs compiled to be either AES or XPG3 compliant, the following is
     true:

     If   owner or group is specified as (uid_t) -l or (gid_t) -l
          respectively, the corresponding ID of the file is unchanged.

     There is no effect on any open file descriptors at the time of the chmod
     or fchmod.

     Upon successful completion, the chown and fchown functions mark the
     st_ctime field of the file for update.

NOTES
     If the /etc/environ file specifies

          ENVIRONMENT = fips
     the fips keyword is equivalent to sys5.3 except that it enables the FIPS
     behavior.

     FIPS behavior causes chown to change the initial acls (inheritance) on a
     directory when its group is changed (as it does in a BSD environment).

     For a more information on FIPS mode, refer to Domain/OS System
     Administration Guide

     Upon successful completion, the chown and fchown functions mark the
     st_ctime field of the file for update.

DIAGNOSTICS
     Upon successful completion, the chown and fchown functions return a value
     of 0 (zero). Otherwise, a value of -1 is returned, the owner and group of
     the file remain unchanged, and errno is set to indicate the error.

ERRORS
     If the chown function fails, errno is set to one of the following values:

     [EACCES]  Search permission is denied on a component of path.

     [EFAULT]  The path parameter is an invalid address.

     [ENAMETOOLONG]
               The length of the path argument exceeds PATH_MAX or a pathname
               component is longer than NAME_MAX.

     [ENOTDIR] A component of path is not a directory.

     [ENOENT]  The path parameter does not exist or points to an empty string.

     [EPERM]   The effective user ID does not match the ID of the owner of the
               file.

               If either the node is configured to be FIPS compliant or if the
               program is compiled to be AES compliant, the following is true:

               chown fails with [EPERM] if someone other than ROOT attempts to
               change owner or group of a file; or if the owner of a file (who
               is not ROOT) attempts to change a file's group to something
               other than the calling process' effective group ID or one of
               its supplementary group IDs.

     [EROFS]   The named file resides on a read-only file system.

     [EINVAL]  The owneror group ID supplied is not a supported value.

     If the fchown() function fails, errno is set to one of the following
     values:

     [EBADF]   The file descriptor filedes is not valid.

     [EROFS]   The file referred to by filedes resides on a read-only file
               system.

     [EPERM]   The effective user ID does not match the ID of the owner of the
               file, and the calling process does not have appropriate
               privilege.

     [EPERM]   The process does not have the chown effective privilege.

     [EINTR]   A signal was caught during the chown system call.

SEE ALSO
     access(2) chmod(2) <sys/types.h> <sys/stat.h> <unistd.h>.  chown(1)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026