id - Return the user identity

Format

  • id [user]
  • id -G [-n] [user]
  • id -g [-nr] [user]
  • id -u [-nr] [user]
  • id -M

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 might 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.

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.
-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

Examples

> id -M
SYSHIGH

Usage notes

For more information about multilevel security and security labels, see z/OS Planning for Multilevel Security and the Common Criteria.

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