|
|
id -G [ -n ] [ user ]
id -g [ -n ] [ -r ] [ user ]
id -u [ -n ] [ -r | -l ] [ user ]
If the user is a member of any supplemental groups, id also shows these. On systems that support a large number of supplemental groups this may make the output very long.
The -s flag is for backwards compatibility and has no effect.
With the -l option, id also outputs the Login User ID (LUID) of the caller.
In the second form, the id command writes three lines of information on the standard output. The first line contains the effective group ID, and the second the real group ID; the last line contains a space-separated list of supplemental groups. Normally the output is in numeric form, but specifying the -n flag shows the ID's in name form.
The third form of id writes the effective group ID of the invoking process, or of the given user in numeric form. The -n flag causes output to be the name of the group, and the -r flag shows the real group ID.
The final form of id writes the effective user ID of the invoking process, or of the given user in numeric form. Again, the -n flag causes the output to be in name form; the -r flag shows the real user ID, and the -l flag shows the login user ID.
When id is given the optional user name, the real,
effective and login ID's are always the same. The user
and group ID's are taken from the password database
entry for that user. The supplemental group list is taken to be
all the entries in the group database for that user, the
supplemental group list of a process being a subset of these.
uid=12460(fred) gid=7003(trusted) luid=12460(fred) groups=7003(trusted),50(group)id -G produces:
7003 7003 7003 50id -g -r would output:
7003id -u -l -n would output:
fredid daemon would produce:
uid=1(daemon) gid=1(other) groups=1(other),2(bin),4(adm),12(daemon)
ISO/IEC DIS 99452:1992, Information technology Portable Operating System Interface (POSIX) Part 2: Shell and Utilities (IEEE Std 1003.21992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.