replay sudo session logs
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
option in the sudoers file. When a command is run via
enabled in the sudoers file, a
TSID=ID string is logged via syslog or to the
sudo log file. The ID may also be
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 output has not been redirected,
sudoreplay will act on the following keys:
\n’ or ‘
The options are as follows:
sudoreplaywill display the command's standard output, standard error and tty output. The filter argument is a comma-separated list, consisting of one or more of following: stdout, stderr, and ttyout.
sudoreplaywill list available sessions in a format similar to the
sudolog file format, sorted by file name (or sequence number). If a search expression is specified, it will be used to restrict the IDs that are displayed. An expression is composed of the following predicates:
sudowas run this field will be empty in the log.
sudoruns commands as user root by default.
Predicates may be abbreviated to the shortest unique string (currently all predicates may be shortened to a single character).
Predicates may be combined using and,
! operators as well
)’ grouping (note that
parentheses must generally be escaped from the shell). The
and operator is optional, adjacent predicates have an
implied and unless separated by an
sudoreplaywill accurately reproduce the delays between key presses or program output. However, this can be tedious when the session includes long pauses. When the
-moption is specified,
sudoreplaywill limit these pauses to at most max_wait seconds. The value may be specified as a floating point number, e.g. 2.5.
sudoreplayto adjust the number of seconds it will wait between key presses or program output. This can be used to slow down or speed up the display. For example, a speed_factor of 2 would make the output twice as fast whereas a speed_factor of .5 would make the output twice as slow.
sudoreplayversions version number and exit.
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
Note that the
stdout and stderr files will be empty
sudo was used as part of a pipeline for a
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
Todd C. Miller
If you feel you have found a bug in
sudoreplay, please submit a bug report at
Limited free support is available via the sudo-users mailing list, see https://www.sudo.ws/mailman/listinfo/sudo-users 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 https://www.sudo.ws/sudo/license.html for