Linux Commands / IT Support Guides
Check Linux user identity and groups with id
Check the user and groups that Linux sees for your current shell.
Environment and inputs: Linux · Bash-compatible shell; package and service names vary by distribution
Understand the problem
Run the checks in the same terminal session that saw the error. A service may use a different account from your shell.
Run the command
Run id to list user and group IDs. Run groups to get a shorter list of group names.
id
groups
Read the output
In an id result, uid identifies the user, gid identifies the primary group and groups lists group memberships. If access depends on a particular group, check whether it appears in this session.
Choose the next step
If the account was just added to a group, start a fresh login session and run id again. Existing sessions can keep their previous group memberships.
Before making changes
Compare the account with the service or file policy before granting new access. Confirm that the intended account can perform the task.