id command
The command that prints the user and group identity a command is running as.
In more detail
id -u prints only the numeric user ID and id -g the group ID. Numbers avoid any confusion about display names.
Example
ansible localhost -m ansible.builtin.command -a "id -u" shows which account a task really ran as.Related terms
- UID and GID — The numbers Linux uses to identify a user (UID) and a group (GID); root is UID 0.
- become — The Ansible keyword that switches on privilege escalation, so a task or a whole play runs as another account, root by default.
- command module — The module that runs any program you name on the host and reports what it printed, without being able to tell whether it changed anything.
- chgrp — The command that changes the group that owns a file.
- owner, group and others — The three sets of people a Unix file's permissions are written for: its owning user, its group, and everyone else.
Taught in
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Permissions And Ownership — Bash Scripting & Command Line Automation
- Mock Exam, Part 2: Real Machines And The Patterns That Fail — RHCE in Ansible (EX294): Automate Red Hat Systems