SUDOREPLAY(8)
๐ sudoreplay ๐ (manual section 8: replay sudo session logs)
โจ NAME โจ
sudoreplay ๐ replay sudo session logs
๐ฆ SYNOPSIS ๐ฆ
sudoreplay [-FhnRS] [-d dir] [-f filter] [-m num] [-s num] ID[@offset]
sudoreplay [-h] [-d dir] -l [search expression]
๐ธ DESCRIPTION ๐ธ
okay so sudoreplay is the app that lets you replay or list the output logs sudo makes. when you're replaying, it can play the session back in real-time, or you can speed it up or slow it down with your command line options. so iconic ๐ฅ
the ID should be either a six character combo of digits and upper case letters, like โ0100A5โ, or a path name. the ID can also have an optional @offset suffix if you want to start replaying from a specific spot. the offset is a number of seconds since the session started, and it can have a decimal fraction. bestie, that's giving precision ๐ง
path names can be relative to the I/O log directory /var/log/sudo-io (unless you override it with the -d option), or fully qualified, which means they start with a / character. when a command runs through sudo with log_output turned on in the sudoers file, a TSID=ID string gets logged via syslog(3) or into the sudo log file. you can also figure out the ID using sudoreplay's list mode ๐
in list mode, sudoreplay can hunt down the ID of a session based on stuff like the user, the tty, or the command that was run. main character energy ๐
in replay mode, if standard input and output are connected to a terminal and you didn't pass -n, sudoreplay goes interactive ๐ซถ in interactive mode it tries to resize your terminal to match the session and writes straight to the terminal (heads up, not every terminal supports this ๐). it also keeps an eye on the keyboard and reacts to these keys:
\nor\rโ skip to the next replay event. super useful when there are long pauses ๐ญ' '(space) โ pause the output. press any key to resume โจ<โ cut the playback speed in half ๐>โ double the playback speed ๐ฅ
you can interrupt the session with control-C. when it's finished, the terminal goes back to its original size if it got changed during playback. ngl that's very considerate of it ๐
๐ OPTIONS ๐
-d dir,--directory=dirโ store session logs indirinstead of the default,/var/log/sudo-io๐-f filter,--filter=filterโ pick which I/O type(s) to show. by default you get the command's standard output, standard error, and tty output. the filter is a comma-separated list made of one or more of these:stdin,stdout,stderr,ttyin, andttyout๐-F,--followโ turns on โfollow modeโ ๐ฆ when you're replaying, sudoreplay ignores end-of-file and keeps going until the log is complete, kind of liketail -f. this is how you watch a session that's still happening live. an I/O log file counts as complete once the write bits get cleared on the session's timing file. heads up: sudo versions before 1.9.1 don't clear the write bits when they finish, so follow mode won't know when to stop with those ๐-h,--helpโ shows a short help message on standard output and exits ๐ง-l,--list [search expression]โ turns on โlist modeโ ๐ in this mode, sudoreplay lists the available sessions in a format similar to the sudo log file format, sorted by file name (or sequence number). any control characters in the log data get formatted in octal with a leading#character. so a horizontal tab shows up as#011and an embedded carriage return shows up as#015. space characters in the command name and arguments get octal formatting too, so it's all very encoded ๐
if you add a search expression, it restricts which IDs get displayed. an expression is built from these predicates:
command patternโ true if the command run matches the POSIX extended regular expressionpattern๐cwd directoryโ true if the command was run with the specified current working directory ๐ธfromdate dateโ true if the command was run on or afterdate. see โDate and time formatโ for the supported date and time formats โฐgroup runas_groupโ true if the command was run with the specifiedrunas_group. unless arunas_groupwas explicitly given when sudo ran, this field is empty in the log ๐ซhost hostnameโ true if the command was run on the specifiedhostname๐runas runas_userโ true if the command was run as the specifiedrunas_user. by default sudo runs commands as the root user ๐todate dateโ true if the command was run on or prior todate. see โDate and time formatโ for the supported formats ๐tty tty nameโ true if the command was run on the specified terminal device. write the tty name without the/dev/prefix, sotty01instead of/dev/tty01๐user user nameโ true if the ID matches a command run byuser name๐
predicates can be abbreviated to the shortest unique string โจ
you can combine predicates with the and, or, and ! operators, and group them with ( and ). parentheses usually need escaping from the shell. the and operator is optional, since adjacent predicates have an implied and unless you separate them with an or ๐ง
-m max_wait,--max-wait max_waitโ sets an upper bound on how long to wait between key presses or output data ๐ฆ by default, sudoreplay copies the delays between key presses or program output exactly. that can be super tedious when the session has long pauses, so with-mit caps those pauses atmax_waitseconds. the value can be a floating point number, like2.5. amax_waitof zero or less removes the pauses entirely ๐ซถ-n,--non-interactiveโ no asking for user input and no attempts to resize the terminal ๐ the session gets written to standard output instead of straight to the user's terminal-R,--no-resizeโ don't try to resize the terminal to match the session's terminal size ๐-S,--suspend-waitโ wait while the command was suspended โณ by default, sudoreplay skips the time between when the command got suspended and when it resumed. if you pass-S, it waits through that gap instead ๐-s speed_factor,--speed speed_factorโ changes how many seconds sudoreplay waits between key presses or program output. use it to slow things down or speed them up ๐ for example, aspeed_factorof2makes the output twice as fast, while aspeed_factorof.5makes it twice as slow ๐ข-V,--versionโ prints sudoreplay's version number and exits ๐ข
๐ FILES ๐
okay bestie, these are the files sudoreplay cares about ๐๏ธโจ
/etc/sudo.confโ the config for sudo's debugging framework ๐ง/var/log/sudo-ioโ the default I/O log directory ๐๐/var/log/sudo-io/00/00/01/logโ example session log info ๐/var/log/sudo-io/00/00/01/log.jsonโ example session log info, but in JSON format ๐งพ/var/log/sudo-io/00/00/01/stdinโ an example session standard input log โจ๏ธ/var/log/sudo-io/00/00/01/stdoutโ an example session standard output log ๐จ๏ธ/var/log/sudo-io/00/00/01/stderrโ an example session standard error log ๐จ/var/log/sudo-io/00/00/01/ttyinโ an example session tty input file ๐น/var/log/sudo-io/00/00/01/ttyoutโ an example session tty output file ๐บ/var/log/sudo-io/00/00/01/timingโ an example session timing file โฑ๏ธ
heads up ๐ thestdin,stdoutandstderrfiles will be empty unless sudo was used as part of a pipeline for a particular command. so if you're wondering why they look sad and blank, that's why ๐
๐ EXAMPLES ๐
okay, the examples are where it all clicks ๐ let's go!
List sessions run by user millert:
# sudoreplay -l user millert
List sessions run by user bob with a command containing the string vi:
# sudoreplay -l user bob command vi
List sessions run by user jeff that match a regular expression:
# sudoreplay -l user jeff command '/bin/[a-z]*sh'
List sessions run by jeff or bob on the console:
# sudoreplay -l ( user jeff or user bob ) tty console
๐ฆ SEE ALSO ๐ฆ
if you want more lore, go check out these bestie ๐๐ซถ
script(1), sudo.conf(5), sudo(8)
๐ AUTHORS ๐
so a lot of people have worked on sudo over the years ๐ but this version is mostly the work of:
Todd C. Miller ๐
for an exhaustive list of everyone who has contributed, check out the CONTRIBUTORS.md file in the sudo distribution, or https://www.sudo.ws/about/contributors/ โจ
๐ BUGS ๐
if you think you've found a bug in sudoreplay, you have two options: file a bug report in the sudo bug database at https://bugzilla.sudo.ws/, or open an issue at https://github.com/sudo-project/sudo/issues. ๐
prefer email? you can send messages to the sudo-workers mailing list at https://www.sudo.ws/mailman/listinfo/sudo-workers (public), or to <sudo@sudo.ws> (private) ๐
bestie, pls pls pls ๐ฅบ do not report security vulnerabilities through public GitHub issues, Bugzilla or mailing lists. instead, email them to<Todd.Miller@sudo.ws>. you can encrypt your message with PGP if you want, using the key found athttps://www.sudo.ws/dist/PGPKEYS. security stuff stays safe that way ๐๐
๐ซง SUPPORT ๐ซง
limited free support is available through the sudo-users mailing list. check https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or to search the archives ๐ฌโจ
โ๏ธ DISCLAIMER โ๏ธ
sudoreplay is provided โAS ISโ ๐ซ and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. for complete details, see the LICENSE.md file distributed with sudo, or https://www.sudo.ws/about/license/ ๐
bestie that's the whole page!! ๐ we did it, you're officially a sudoreplay girlie now ๐ ๐ธ the release info at the bottom is sudo 1.9.17p2 from January 16, 2023, and the man page itself is SUDOREPLAY(8) ๐ง๐
๐ฆ where this page comes from
- alpine 3.24: sudo-doc 1.9.17_p2-r2 ยท custom ISC
- arch rolling: sudo 1.9.17.p2-6 ยท custom
- centos-stream 10: sudo 1.9.17-13.p2.el10 ยท ISC
- centos-stream 9: sudo 1.9.17p2-6.el9 ยท ISC
- fedora 43: sudo 1.9.17-7.p2.fc43 ยท ISC
- fedora 44: sudo 1.9.17-10.p2.fc44 ยท ISC
- fedora 44: sudo 1.9.17-7.p2.fc44 ยท ISC
- nixos 26.05: sudo 1.9.17p2
- nixpkgs unstable: sudo 1.9.17p2
- ๐ the page's license: ISC
- Copyright (c) 2009-2023 Todd C. Miller <Todd.Miller@sudo.ws>
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms