sudo
A command that runs another command with administrator (root) rights after checking you are allowed to.
In more detail
sudo stands for substitute user do, and it records who ran what. It is needed for jobs that change files every user shares, such as installing system packages. Which accounts may use sudo, and whether they need a password, is configured on each machine.
Examples
sudo is Ansible's default become method; --ask-become-pass supplies its password.sudo apt install git-allsudo reads a policy, the sudoers file, that says which users may run which commands as which target user. Each use is logged, and a rule can allow one specific command, such as restarting one service, instead of a full root shell. Prefer narrow rules; sudo -l shows what you are allowed to run.auditd's auid names the human behind a sudo command.Related terms
- become — The Ansible keyword that switches on privilege escalation, so a task or a whole play runs as another account, root by default.
- become method — The setting that chooses which tool Ansible uses to escalate privilege: sudo by default, or alternatives such as su, doas or pbrun.
- root user — The all-powerful administrator account on Linux, with user ID 0, which can read or change anything.
- privilege escalation — Gaining the rights of a more powerful account, such as root, either deliberately through a tool like sudo or illegitimately through a flaw.
- tee — A command that copies its standard input both to one or more files and to its standard output.
- docker group — A Linux user group whose members may use Docker without sudo, which in practice gives them root on the host.
- package manager — A tool that installs, updates and removes software together with what it depends on, such as apt on Debian, apk on Alpine or Homebrew on macOS.
- sudoers file — The configuration file, /etc/sudoers plus files in /etc/sudoers.d, that says who may run which commands as which user through sudo.
- least privilege — Giving every program and person only the access they need, and nothing more.
- audit trail — A record of who did what and when, kept so actions can be reviewed and investigated later.
- system Python — The copy of Python that the operating system installs for its own tools, which you should leave alone.
- virtual environment — A self-contained folder with its own Python and its own installed packages, so each project's packages stay separate.
Taught in
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Which Shell Am I In, And Getting Bash Five — Bash Scripting & Command Line Automation
- Help, History, Completion And Aliases — Bash Scripting & Command Line Automation
- Pipelines, tee And Process Substitution — Bash Scripting & Command Line Automation
- Permissions And Ownership — Bash Scripting & Command Line Automation
- Archives, Transfers And The Network — Bash Scripting & Command Line Automation
- Spend Two Hours Like A Points Table — Certified Kubernetes Administrator (CKA) Exam Prep
- Preparing A Node Before kubeadm Will Touch It — Certified Kubernetes Administrator (CKA) Exam Prep
- kubeadm init And join: What Lands Where — Certified Kubernetes Administrator (CKA) Exam Prep
- Upgrades In The Only Order That Works — Certified Kubernetes Administrator (CKA) Exam Prep
- etcd: Snapshot, Restore, And The Cache That Lies — Certified Kubernetes Administrator (CKA) Exam Prep
- CNI, CSI, CRI And CRDs: The Plug-In Points — Certified Kubernetes Administrator (CKA) Exam Prep
- Two Hours, Sixteen Tasks: A CKS Plan — Certified Kubernetes Security Specialist (CKS) Exam Prep
- CIA Triad, Non-Repudiation & Parkerian Hexad — Cybersecurity Fundamentals, GRC & Cryptography
- Install Docker And Verify Your Environment — Docker Architecture & Production Containers
- CMD, ENTRYPOINT, USER And Process Signals — Docker Architecture & Production Containers
- Compute Engine — Google Cloud Associate Cloud Engineer Exam Prep
- Running Compute Engine — Google Cloud Associate Cloud Engineer Exam Prep
- Installing Git, And Telling It Who You Are — Advanced Git Internals & Distributed Workflows
- GitHub-Hosted And Larger Runners: Specs, Software And Networks — GitHub Actions (GH-200) Exam Prep
- Setuid, Setgid, And Root Through sudo — Linux Fundamentals & Systems Administration
- Installing Python On Linux — Hands-on Python: Complete Video Course & Book
- First Run, And Fixing A Broken Install — Hands-on Python: Complete Video Course & Book
- Logins, su, sudo And SSH Between Hosts — Red Hat Certified System Administrator (EX200) Exam Prep
- Privileged Access: sudo Rules In Drop-In Files — Red Hat Certified System Administrator (EX200) Exam Prep
- Recovering Root And Changing The Boot Loader — Red Hat Certified System Administrator (EX200) Exam Prep
- Logs, The Journal, And Keeping It Across Reboots — Red Hat Certified System Administrator (EX200) Exam Prep
- Scheduling: cron, at And systemd Timers — Red Hat Certified System Administrator (EX200) Exam Prep
- Drill: The Machine That Will Not Boot — Red Hat Certified System Administrator (EX200) Exam Prep
- Drill: Storage, Then SELinux, Then The Firewall — Red Hat Certified System Administrator (EX200) Exam Prep
- Drill: People, Packages And Time — Red Hat Certified System Administrator (EX200) Exam Prep
- SIEM Architecture: Ingestion Pipelines & Indexing — Security Operations & Threat Hunting (SOC)
- Windows Event Logs, Sysmon & Linux Auditd Telemetry — Security Operations & Threat Hunting (SOC)
- The Pager Goes Off At 2 A.M.: A Three-Question Triage — CompTIA Linux+ (XK0-006) Exam Prep
- Starters, Leavers And A Service Account: Accounts On Two Families — CompTIA Linux+ (XK0-006) Exam Prep
- One Word Locked Out Every Directory User: PAM, SSSD, LDAP And Kerberos — CompTIA Linux+ (XK0-006) Exam Prep
- Who Wrote That Sudoers File? The Journal, rsyslog, logrotate And auditd — CompTIA Linux+ (XK0-006) Exam Prep
- One Rule, Four Firewalls: firewalld, ufw, nftables And iptables — CompTIA Linux+ (XK0-006) Exam Prep
- The Pager Command That Opened A Root Shell: sudo, su And Least Privilege — CompTIA Linux+ (XK0-006) Exam Prep
- Root Over SSH From Anywhere: Keys, sshd, setuid Files And Attributes — CompTIA Linux+ (XK0-006) Exam Prep
- Three Audit Findings And A Phone: Password Policy, Lockouts And MFA — CompTIA Linux+ (XK0-006) Exam Prep
- When awk Runs Out: Python Data Types, Modules And Virtual Environments For Admins — CompTIA Linux+ (XK0-006) Exam Prep
- Three PBQs Against The Clock: A Performance-Based Mock On Both Families — CompTIA Linux+ (XK0-006) Exam Prep
- Ninety Minutes, Five Domains: The Full Mock And The Week Before The Exam — CompTIA Linux+ (XK0-006) Exam Prep
- Exam Strategy: Hosts, Help And The Order Of Twenty Tasks — Linux Foundation Certified System Administrator (LFCS) Exam Prep
- Accounts On Ubuntu: Skeletons, Groups And Offboarding — Linux Foundation Certified System Administrator (LFCS) Exam Prep
- Environment Profiles: Which File Does This Shell Read? — Linux Foundation Certified System Administrator (LFCS) Exam Prep
- User Limits: Who Gets Which Number At Login — Linux Foundation Certified System Administrator (LFCS) Exam Prep
- Mock Exam, Part 1: Seventeen Tasks, One Reboot — Linux Foundation Certified System Administrator (LFCS) Exam Prep
- Security Rounds: Special Bits, Logins, Ports And sudo — LPIC-1 Linux Administrator (101-500 and 102-500) Exam Prep
- Exam Strategy: The First Fifteen Minutes And ansible-doc — RHCE in Ansible (EX294): Automate Red Hat Systems
- ansible.cfg: Which File Wins, And The Settings That Matter — RHCE in Ansible (EX294): Automate Red Hat Systems
- SSH Keys And An Account For Ansible — RHCE in Ansible (EX294): Automate Red Hat Systems
- Privilege Escalation: sudo Rules And become — RHCE in Ansible (EX294): Automate Red Hat Systems
- Drill: Storage Only Where The Disk Exists — RHCE in Ansible (EX294): Automate Red Hat Systems
- Drill: People, Passwords And sudo From The Vault — RHCE in Ansible (EX294): Automate Red Hat Systems
- Mock Exam, Part 2: Real Machines And The Patterns That Fail — RHCE in Ansible (EX294): Automate Red Hat Systems
References
Certification courses
- CKA course and practice exam: Certified Kubernetes Administrator
- CKS course and practice exam: Certified Kubernetes Security Specialist
- Google Associate Cloud Engineer course and practice exam: Google Cloud certification
- GH-200 course and practice exam: GitHub Actions
- RHCSA course and practice exam: Red Hat Certified System Administrator (EX200)
- CompTIA Linux+ course and practice exam: XK0-006
- LFCS course and practice exam: Linux Foundation Certified System Administrator
- LPIC-1 course and practice exam: Linux Administrator (101-500 and 102-500)
- RHCE course and practice exam: Red Hat Certified Engineer in Ansible (EX294)