replay sudo session logs


sudoreplay [-hnRS] [-d dir] [-f filter] [-m num] [-s num] ID

sudoreplay [-h] [-d dir] -l [search expression]


sudoreplay plays back or lists the output logs created by sudo . When replaying, sudoreplay can play the session back in real-time, or the playback speed may be adjusted (faster or slower) based on the command line options.

The ID should either be a six character sequence of digits and upper case letters, e.g., 0100A5 , or a pattern matching the iolog_file option in the sudoers file. When a command is run via sudo with log_output enabled in the sudoers file, a TSID=ID string is logged via syslog or to the sudo log file. The ID may also be determined using sudoreplay 's list mode.

In list mode, sudoreplay can be used to find the ID of a session based on a number of criteria such as the user, tty or command run.

In replay mode, if the standard input and output are connected to a terminal and the -n option is not specified, sudoreplay will operate interactively. In interactive mode, sudoreplay will attempt to adjust the terminal size to match that of the session and write directly to the terminal (not all terminals support this). Additionally, it will poll the keyboard and act on the following keys:

The session can be interrupted via control-C. When the session has finished, the terminal is restored to its original size if it was changed during playback.

The options are as follows:

Date and time format

The time and date may be specified multiple ways, common formats include:

Either time or date may be omitted, the am/pm and timezone are optional. If no date is specified, the current day is assumed; if no time is specified, the first second of the specified date is used. The less significant parts of both time and date may also be omitted, in which case zero is assumed.

The following are all valid time and date specifications:

Note that relative time specifications do not always work as expected. For example, the ``next'' qualifier is intended to be used in conjunction with a day such as ``next Monday .'' When used with units of weeks, months, years, etc the result will be one more than expected. For example, ``next week'' will result in a time exactly two weeks from now, which is probably not what was intended. This will be addressed in a future version of .

Debugging sudoreplay

sudoreplay versions 1.8.4 and higher support a flexible debugging framework that is configured via Debug lines in the sudo.conf(5) file.

For more information on configuring sudo.conf(5), please refer to its manual.


Note that the stdin , stdout and stderr files will be empty unless sudo was used as part of a pipeline for a particular command.


List sessions run by user millert : -literal -offset indent # sudoreplay -l user millert

List sessions run by user bob with a command containing the string vi: -literal -offset indent # sudoreplay -l user bob command vi

List sessions run by user jeff that match a regular expression: -literal -offset indent # sudoreplay -l user jeff command '/bin/[a-z]*sh'

List sessions run by jeff or bob on the console: -literal -offset indent # sudoreplay -l ( user jeff or user bob ) tty console


Many people have worked on sudo over the years; this version consists of code written primarily by: -ragged -offset indent Todd C. Miller

See the CONTRIBUTORS file in the sudo distribution ( for an exhaustive list of people who have contributed to sudo .


If you feel you have found a bug in , please submit a bug report at


Limited free support is available via the sudo-users mailing list, see to subscribe or search the archives.


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. See the LICENSE file distributed with sudo or for complete details.


script(1), sudo.conf(5), sudo(8)

Copied to clipboard
free 100$ digital ocean credit