Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ chown(2) — HP-UX 5.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chown(1)

chmod(2)

CHOWN(2)  —  HP-UX

NAME

chown, fchown − change owner and group of a file

SYNOPSIS

int chown (path, owner, group)
char ∗path;
int owner, group; fchown (fd, owner, group)
int fd, owner, group;

DESCRIPTION

Path points to a path name naming a file.  Fd is a descriptor for a file.  The owner ID and group ID of the file are set to the numeric values contained in owner and group respectively.  A value of −1 can be specified in owner or group to leave unchanged the file’s owner ID or group ID respectively.  Note that owner and group should be less than or equal to 65535, since only the least significant 16 bits are used. 

Only processes with effective user ID equal to the file owner or super-user may change the ownership of a file.  If privilege groups are supported, the owner of a file may change the ownership only if he is a member of a privilege group allowing chown, as set up by setprivgrp. All users get chown privileges by default. 

The group ownership of a file can be changed to any group in the current process’s access list or to the real or effective group id of the current process.   If privilege groups are supported and the user is permitted the chown privilege, then the file can be given to any group. 

If chown is invoked by other than the super-user, the set-user-ID and set-group-ID bits of the file mode will be cleared. 

ERRORS

Chown will fail and the owner and group of the file will remain unchanged if one or more of the following are true:

­[EBADF] Fd is not a valid file descriptor. 

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

­[ENOENT] The named file does not exist. 

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

­[EPERM] EPERM is set when the effective user ID is not super-user and one or more of the following conditions exist:

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

When changing the owner of the file, if the owner of the file is not a member of a privilege group allowing chown.

When changing the group of the file, if the owner of the file is not a member of a privilege group allowing chown and the group number is not in the current process’s access list. 

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

­[EFAULT] Path points outside the allocated address space of the process.  The reliable detection of this error will be implementation dependent. 

­[ENAMETOOLONG] The named file exceeds MAXPATHLEN characters. 

HARDWARE DEPENDENCIES

Integral Personal Computer:
For superuser capabilities described above, it is not necessary to be superuser.

Series 500:
Chown changes the owner and group of files created only in the HP-UX environment (that is, not those created by the HP 9000 BASIC Language System). 

Fchown is not currently implemented. 

RETURN VALUE

Upon successful completion, a value of 0 is returned.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

AUTHOR

Fchown was developed by the University of California, Berkeley California, Computer Science Division, Department of Electrical Engineering and Computer Science. 

SEE ALSO

chown(1), chmod(2). 

Hewlett-Packard Company  —  Version B.1,  May 11, 2021

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