[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 3

id Command

Purpose

Displays the system identifications of a specified user.

Syntax

id [ { -G | -g [ -r ] | -u [ -r ] } [ -n ] ] [ User ]

Description

The id command writes to standard output a message containing the system identifications (ID) for a specified user. The system IDs are numbers which identify users and user groups to the system. The id command writes the following information, when applicable:

The id command also writes effective user and group IDs, but only for the user that invoked the id command. (If the User parameter is specified with the id command, the effective IDs are assumed to be identical to real IDs.) If the effective and real IDs for the invoking user are different, the id command writes the following effective ID information, when applicable:

The id command will fail if the specified user does not exist or if the command cannot read the user or group information.

Flags

The contents and format of the message written by the id command can be altered with the following flags:

-G Specifies that the id command write the effective, real, and supplementary group IDs only. If there are multiple entries for the effective, real, or supplementary IDs, they are separated by a space and placed on the same line.
-g Specifies that the id command write only the effective group ID.
-u Specifies that the id command write only the effective user ID.
-r Specifies that the id command write the real ID instead of the effective ID. This flag can be invoked with either the -g flag to write the real group ID, or the -u flag to write the real user ID.
-n Specifies that the id command outputs the name, instead of the ID number, when it is specified with the -G, -g, and -u flags.
User Specifies the login name of a user for the id command. If no user is specified, the user invoking the id command is the default.

Security

Access Control: This program should be installed as a normal user program in the Trusted Computing Base.

Exit Status

This command returns the following exit values:

0 Successful completion.
>0 An error occurred.

Examples

  1. To display all system identifications for the current user, enter:
    id
    Output for the id command is displayed in the following format:
    uid=1544(sah) gid=300(build) euid=0(root) egid=9(printq) groups=0(system),10(audit)
    In this example, the user has user name sah with an ID number of 1544; a primary group name of build with an ID number of 300; an effective user name of root with an ID number of 0; an effective group name of printq with an ID number of 9; and two supplementary group names of system and audit, with ID numbers 0 and 10, respectively.
  2. To display all group ID numbers for the current user, enter:
    id -G
    Output is displayed in the following format:
    0 10 300 9
    The -G flag writes only the group IDs for a user. In this example, user sah is a member of the system (0), audit (10), build (300), and printq (9) groups.
  3. To display all group names for the current user, enter:
    id -Gn
    Output is displayed in the following format:
    system audit build printq
    The -n flag writes only the names instead of the ID numbers.
  4. To display the real group name for the current user, enter:
    id -gnr
    Output is displayed in the following format:
    build

Files

/usr/bin/id Contains the id command.

Related Information

The getty command, login command, setgroups command, su command, tsm command.


[ Previous | Next | Contents | Glossary | Home | Search ]