chown man page on DigitalUNIX

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
DigitalUNIX logo
[printable version]

chown(2)							      chown(2)

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

SYNOPSIS
       #include <unistd.h>

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

STANDARDS
       Interfaces  documented on this reference page conform to industry stan‐
       dards as follows:

       chown(): POSIX.1, XSH4.0, XSH4.2, XSH5.0

       fchown(): POSIX.1, XSH4.2, XSH5.0

       lchown(): POSIX.1, XSH4.2, XSH5.0

       Refer to the standards(5) reference page	 for  more  information	 about
       industry standards and associated tags.

PARAMETERS
       Specifies the name of the file whose owner ID, group ID, or both are to
       be changed. When the path parameter refers  to  a  symbolic  link,  the
       behaviors of the chown() and the lchown() functions differ. The chown()
       function changes the ownership of the file pointed to by	 the  symbolic
       link.  The lchown() function changes the ownership of the symbolic link
       file itself.  Specifies a valid	open  file  descriptor.	  Specifies  a
       numeric	value  representing  the  owner ID.  Specifies a numeric value
       representing the group ID.

DESCRIPTION
       The chown(), lchown() and fchown() functions change the owner and group
       of a file.

       A  process  can	change the value of the owner ID of a file only if the
       process has superuser privilege.	 A process without superuser privilege
       can  change  the	 group ID of a file only to the value of its effective
       group ID or to a value in its supplementary group list.

       If the value of the owner ID is changed and the process does  not  have
       superuser  privilege,  the set-user ID attribute (the S_ISUID bit) of a
       regular file is cleared.

       The set-user ID attribute (S_ISUID bit) of a file is cleared upon  suc‐
       cessful	return	if:  The file is a regular file.  The process does not
       have superuser privilege.

       The set-group ID attribute (S_ISGID bit) of a file is cleared upon suc‐
       cessful	return	if:  The file is a regular file.  The process does not
       have superuser privilege.

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

       Upon  successful	 completion, the chown(), lchown(), and fchown() func‐
       tions mark the st_ctime field of the file for update.

RETURN VALUES
       Upon successful completion, the chown(), lchown(), and  fchown()	 func‐
       tions 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() or lchown() functions fails, errno may be set to one of
       the following values: Search permission is denied  on  a	 component  of
       path.  The path parameter is an invalid address.	 The owner or group ID
       is not a value supported by this implementation.	 Too many  links  were
       encountered  in	translating  path.   The  length  of the path argument
       exceeds PATH_MAX or a pathname component is longer  than	 NAME_MAX.   A
       component  of  path  is	not  a directory.  The path parameter does not
       exist or is an empty string.  The effective user ID does not match  the
       ID  of  the  owner  of  the file, and the calling process does not have
       appropriate privilege and _POSIX_CHOWN_RESTRICTED indicates  that  such
       privilege is required.  The named file resides on a read-only file sys‐
       tem.  The process' root or current directory is located	in  a  virtual
       file system that has been unmounted.

       If  the fchown() function fails, errno may be set to one of the follow‐
       ing values: The file descriptor filedes is not  valid.	The  owner  or
       group ID is not a value supported by this implementation.

SEE ALSO
       Functions: chmod(2)

       Commands: chown(1)

       Others:: standards(5)

								      chown(2)
[top]

List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net