|HP-UX Reference > G
getaccess(1)HP-UX 11i Version 3: February 2007
getaccess — list access rights to file(s)
getaccess lists for the specified files the effective access rights of the caller (that is, for their effective user ID, effective group ID, and supplementary groups list). By default, the command prints a symbolic representation of the user's access rights to the named file: r or - for read/no read, w or - for write/no write, and x or - for execute/no execute (for directories, search/no search), followed by the file name.
getaccess recognizes the following options and command-line arguments:
Checking access using access control lists is described in acl(5) and aclv(5).
In addition, the write bit is cleared for files on read-only file systems or shared-text programs being executed. The execute bit is not turned off for shared-text programs open for writing because it is not possible to ascertain whether a file open for writing is a shared-text program.
Processes with appropriate privileges have read and write access to all files. However, write access is denied for files on read-only file systems or shared-text programs being executed. Execute access is allowed if and only if the file is not a regular file or the execute bit is set in any of the file's ACL entries.
To use getaccess successfully, the caller must have search access in every directory component of the path name of the file. getaccess verifies search access first by using the caller's effective IDs, regardless of the user and group IDs specified. This is distinct from the case in which the caller can search the path but the user for whom access is being checked does not have access to the file.
Note: a file name argument of - has no special meaning (such as standard input) to getaccess.
LANG determines the language in which messages are displayed.
If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, getaccess behaves as if all internationalization variables are set to "C". See environ(5).
getaccess returns one of the following values:
The following command prints the caller's access rights to file1 using the file's group ID instead of the caller's effective group ID and groups list.
getaccess -g@ file1
Here's how to check access by user ggd in groups red and 19 to all files in the current directory, with access rights expressed as octal values.
getaccess -u ggd -g red,19 -n .* *
Here's how to list access rights for all files under mydir.
find mydir -print | sort | xargs getaccess
chacl(1), getacl(1), lsacl(1), setacl(1), getaccess(2), glossary(9).