Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ chown(2) — DG/UX 4.31

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

chmod(2)

fchmod(2)

fchown(2)



     chown(2)                   DG/UX 4.31                    chown(2)



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

     SYNOPSIS
          int  chown (path, user, group)
          char *  path;
          int     user;
          int     group;

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

     PARAMETERS
          path      Address of a pathname
          user      File's new user id
          group     File's new group id

     DESCRIPTION
          Chown sets the file's user id (st_uid) and group id (st_gid)
          to the numeric values user and group, respectively.  path
          points to a pathname naming 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.

          If the value of user is -1, the user id of the file is left
          unchanged.  Similarly, if the value of group is -1, the
          group id of the file is left unchanged.

          The set-user-id and set-group-id bits of the file mode
          (st_mode) are left unchanged unless the effective user id of
          the calling process is not superuser, in which case they are
          cleared.

          The file's time of last attribute change (st_ctime) is set
          to the current time.

          If chown fails, the user id, group id, and attributes of the
          file remain unchanged.

          Chown and lchown operate identically except for their
          handling of symbolic links.  If the call is to lchown and
          path refers to a symbolic link, the symbolic link is
          handled, not the target of the symbolic link.  chown will
          handle the target of the symbolic link.

     ACCESS CONTROL
          The effective user id of the calling process must be
          superuser or match the user id of the file.




     Licensed material--property of copyright holder(s)         Page 1





     chown(2)                   DG/UX 4.31                    chown(2)



          The process must have permission to resolve path.

     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.

     EXCEPTIONS
          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), chmod(2), fchmod(2), fchown(2).



     Licensed material--property of copyright holder(s)         Page 2



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