Escalating to a root shell to avoid further logging.
What gives it awaysudo su, sudo -i, or sudo bash. Legitimate administrators do this constantly, which is exactly why it is worth knowing it ends the audit trail.
ATT&CK T1548.003Nothing matches that yet. Tell us what you were looking for and it goes on the list.
sudo · Event COMMAND
Someone used sudo to run a command as root or another account, and the log recorded exactly which command. It is the clearest record of privileged activity on a Linux system — and one that is trivially bypassed once a user has a root shell.
Also written as sudo COMMANDsudo log entryTTY= PWD= USER=root COMMAND=sudo command log linux
You, or a program, ran something with administrator rights. Normal when installing software or changing settings.
The critical limitation: once someone obtains an interactive root shell — `sudo su -` or `sudo -i` — subsequent commands are not logged by sudo at all. Alert on the commands that grant that shell as much as on individual dangerous commands, otherwise your audit trail ends exactly where it starts mattering.
Sanitised. Addresses come from the RFC 5737 documentation ranges.
Aug 28 09:44:02 web-01 sudo: jbrooks : TTY=pts/1 ; PWD=/home/jbrooks ; USER=root ; COMMAND=/usr/bin/apt-get install nginx
Aug 28 09:45:11 web-01 sudo: jbrooks : TTY=pts/1 ; PWD=/home/jbrooks ; USER=root ; COMMAND=/bin/su -
Aug 28 09:45:11 web-01 su: pam_unix(su-l:session): session opened for user root(uid=0) by jbrooks(uid=1000) Everything else in the log line is context.
pts/NA remote or terminal-emulator session. unknownNo terminal — a script or automation rather than a person typing. /bin/su or /bin/bash or -iObtains an interactive root shell. Everything after this is invisible to sudo logging. A command editing /etc/sudoersChanging who can escalate. Rarely routine. A command touching /etc/passwd or /etc/shadowAccount manipulation. A package manager commandOrdinary system administration. A command writing to an authorized_keys fileAdding an SSH key, a common persistence route. Most of the time it is one of these.
What gives it awaysudo su, sudo -i, or sudo bash. Legitimate administrators do this constantly, which is exactly why it is worth knowing it ends the audit trail.
ATT&CK T1548.003What gives it awayAny command that edits /etc/sudoers or drops a file into /etc/sudoers.d.
ATT&CK T1548.003What gives it awayCommands writing to an authorized_keys file, particularly for another user or for root.
ATT&CK T1098.004What gives it awayCommands stopping auditd, rsyslog, or a security agent.
ATT&CK T1562.001What gives it awayCommands reading /etc/shadow, private keys, or application configuration holding secrets.
ATT&CK T1552.001grep 'sudo:' /var/log/auth.log | grep -oP 'COMMAND=\K.*' | sort | uniq -c | sort -rn | head -30 grep -E 'sudo:.*COMMAND=(/bin/su|/bin/bash|/usr/bin/sudo -i|/bin/sh)' /var/log/auth.log journalctl _COMM=sudo --since '7 days ago' | grep -E 'sudoers|authorized_keys|/etc/shadow|/etc/passwd' index=linux sourcetype=linux_secure sudo | rex "USER=(?<runas>\S+)\s+COMMAND=(?<cmd>.*)" | stats count by user runas cmd | sort count asc process.name:"sudo" and system.auth.sudo.command:* | stats count by user.name, system.auth.sudo.command No, and this is the most important thing to know about sudo logging. It logs the command passed to sudo, so `sudo apt-get install nginx` is recorded in full. But `sudo su -` or `sudo -i` gives the user an interactive root shell, and everything typed in that shell is invisible to sudo. For coverage past that point you need auditd or shell session recording.
In /var/log/auth.log on Debian and Ubuntu, and /var/log/secure on Red Hat, CentOS, and Fedora. On systemd hosts, `journalctl _COMM=sudo` works regardless of which files exist. sudo can also be configured to log to its own file or to send logs to a remote host.
sudo alone is not enough because of the interactive shell gap. Use auditd with rules on the execve syscall, which records every command execution at the kernel level regardless of how the shell was obtained. Shell history is not a substitute — it is user-writable and trivially cleared.
There was no terminal attached, which means the command came from a script, a cron job, or automation rather than a person typing. It is entirely normal for configuration management tooling, and worth a second look when the command is one a human would usually run interactively.
Last reviewed 28 August 2026