Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ chown(2) — DG/UX R4.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

fchmod(2)

fchown(2)



chown(2)                          SDK R4.11                         chown(2)


NAME
       chown, lchown - change user id and group id of a file

SYNOPSIS
       #include <unistd.h>
       #include <sys/types.h>

       int  chown (path, user, group)
       const char * path;
       uidt  user;
       gidt  group;

       int  lchown (path, user, group)
       const char * path;
       uidt  user;
       uidt  group;

DESCRIPTION
       Use chown and lchown to set the access of a file:

        path   is the pathname of the file whose access is to be changed. It
               may identify a file of type ordinary, directory, FIFO, block
               special, character special, or symbolic link. The file cannot
               reside on a file system device mounted read-only.

        user   is the new user id (stuid) for the file. A value of -1
               leaves the user id unchanged.

        group  is the new group id (stgid) for the file. A value of -1
               leaves the group id unchanged.

       If the call succeeds, the file's time of last attribute change
       (stctime) is set to the current time.  If the call fails, the user
       id, group id, and attributes of the file remain unchanged.

       The chown(2) and lchown(2) calls operate identically except for their
       handling of symbolic links.  If path is a symbolic link, lchown(2)
       changes the access of the symbolic link, not that of its target. By
       contrast, chown changes the access of the target of the symbolic
       link.

       If chown(2) or lchown(2) is invoked by a process without appropriate
       privilege, the set-user-ID and set-group-ID bits of the file mode,
       S_ISUID and S_ISGID respectively, are cleared.

ACCESS CONTROL
       The process must have permission to resolve path.

       The calling process must have appropriate privilege or the effective
       user id of the calling process must match the user id of the file.

       For systems supporting the DG/UX Capability Option, appropriate
       privilege is defined as having one or more specific capabilities
       enabled in the effective capability set of the calling process.  See
       capdefaults(5) for the default capability for this system call.

       On systems without the DG/UX Capability Option, appropriate privilege
       means that the process has an effective UID of root.  See the
       appropriateprivilege(5) man page for more information.

       When customizing the DG/UX system, the installer or administrator may
       restrict access to any file. Use of chown(2) or lchown(2) with a
       restricted file is further limited as follows: (1) only a user with
       appropriate privilege can modify a restricted file's user id; (2) a
       process whose effective user ID matches the user ID of the file may
       change the group ID, but only to the process's effective group ID, or
       to one of the process's supplementary IDs.  To find out whether
       access to a file is restricted, use pathconf(2) with the
       _PC_CHOWN_RESTRICTED argument.

RETURN VALUE
       0      The user id and group id of the file were successfully
              changed.

       -1     An error occurred.  errno is set to indicate the error.

DIAGNOSTICS
       Errno may be set to one of the following error codes:

       EPERM          Permission to change the file's user and group id is
                      denied.

       EROFS          The named file resides on a file system device mounted
                      read-only.

       ENOENT         The file the pathname resolved to does not exist.

       ENOENT         A non-terminal component of the pathname does not
                      exist.

       ENOTDIR        A non-terminal component of the pathname was not a
                      directory or symbolic link.

       ENAMETOOLONG   The pathname exceeds the length limit for pathnames.

       ENAMETOOLONG   A component of the pathname exceeds the length limit
                      for filenames.

       ENOMEM         There are not enough system resources to resolve the
                      pathname or to expand a symbolic link.

       ELOOP          The number of symbolic links encountered during
                      pathname resolution exceeded MAXSYMLINKS.  A symbolic
                      link cycle is suspected.

       EPERM          The pathname contains a character not in the allowed
                      character set.

       EFAULT         The pathname does not completely reside in the
                      process's address space or the pathname does not
                      terminate in the process's address space.

SEE ALSO
       chmod(1), fchmod(2), fchown(2), appropriateprivilege(5).
       capdefaults(5).


Licensed material--property of copyright holder(s)

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