id — Return the user identity

Format

Description

id displays the user name and group affiliations of the user who issued the command. Specifying a user argument on the command line displays the same information for the given user instead of the person invoking id. In this case, you require appropriate permissions.

The output has the format:
uid=runum(username) gid=rgnum(groupname)
where runum is the user's real user ID (UID) number, username is the user's real user name, rgnum is the user's real group ID (GID) number, and groupname is the user's real group name.
A user's real and effective IDs may differ. In this case, there may be separate entries for effective user ID (UID) with the format:
euid=eunum(euname)
where eunum is the effective user ID number and euname is the effective user name. An entry for effective group ID has the format:
egid=egnum(egname)
where egnum is the effective group ID number and egname is the effective group name.
If a user is a member of other supplemental groups, these are listed at the end of the output, with this format:
groups=gnum(groupname)
where gnumis the user's supplemental group ID number and groupname is the user's supplemental group name.

id may also display the multilevel security label for the user's current address space. See z/OS Planning for Multilevel Security and the Common Criteria for more information about multilevel security.

Options

–G
Displays all different group IDs (effective, real, and supplementary) as numbers separated by spaces.
–g
Displays only the effective group ID number.
–M
Displays the multilevel security label for the user's current address space. See z/OS Planning for Multilevel Security and the Common Criteria for more information about multilevel security.
–n
With –G, –g, or –u, displays the name rather than the number.
–r
With –g or –u, displays the real ID rather than the effective one.
–u
Displays only the effective user ID number.

Localization

id uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • LC_NUMERIC
  • NLSPATH

See Localization for more information.

Examples

> id -M
SYSHIGH

Usage notes

See z/OS Planning for Multilevel Security and the Common Criteria for more information about multilevel security and seclabels.

Exit values

0
Successful completion
1
You specified an incorrect user with the –u option
2
Failure due to an incorrect command-line argument

Portability

POSIX.2, X/Open Portability Guide, UNIX System V.

Related information

logname