Vol. I · No. 46The command line sectionSat, 10 Oct 2026
Linux · users & permissions

id

ids and group membership

id shows who a user is as the kernel sees them: a user id, a group id, and a list of groups. Permissions are decided by these numbers, so when access is denied, this is where to look.

"Permission denied" on a group-readable file? id tells you whether you are in the group.

uid
User id
0 is root; people start at 1000
gid
Primary group
given to files you create
groups
All memberships
each grants access
Another user
id NAME
no root needed

At the terminal

Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.

user@netflow — bashcoreutils
$ id
1uid=1000(user) gid=1000(user) groups=1000(user),27(sudo),998(docker)
2$ id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
3$ id -u root
0
4$ id -nG
user sudo docker
Illustrative session · names, sizes and dates are examples, and every address is from a documentation or private range
Reading the output

What the numbered lines are telling you

1
Your identity, in full

User id 1000, primary group 1000, and membership of sudo and docker. Each number is shown with its name.

2
A service account

The web server’s account has a low id and belongs only to its own group — as little access as possible.

3
root is user id 0

The kernel grants root’s powers to id 0, whatever the account is called.

4
Group names only

-n prints names instead of numbers and -G lists all groups: a compact answer to "what groups am I in?"

Switches

A switch changes how the command behaves. These are the ones used day to day; man id lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.

-u
Print only the user id.
-g
Print only the primary group id.
-G
Print every group id.
-n
With -u, -g or -G, print names instead of numbers.
-r
Print the real id rather than the effective one.

Variations worth knowing

The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.

groups

Lists your group names — the same as id -nG.

getent passwd user

Shows a user’s account record: id, home directory and shell.

getent group docker

Lists the members of a group.

newgrp docker

Starts a shell with a newly added group active, without logging out.

In cybersecurity

Group membership is where privilege hides in plain sight.

Groups that amount to root

Members of sudo or wheel can become root. Members of docker, disk or lxd can too, by less obvious routes. Review who is in them.

More than one uid 0

A second account with user id 0 is a second root, whatever its name. There should be exactly one.

Changes need a new login

Adding a user to a group does not affect sessions already open — and removing them does not either, until those sessions end.

Filed under

Users & permissions

Read alongside