{
    "mode": "man",
    "parameter": "sudoreplay",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/sudoreplay/8/json",
    "generated": "2026-06-12T15:06:20Z",
    "synopsis": "sudoreplay [-FhnRS] [-d dir] [-f filter] [-m num] [-s num] ID[@offset]\nsudoreplay [-h] [-d dir] -l [search expression]",
    "sections": {
        "NAME": {
            "content": "sudoreplay — replay sudo session logs\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "sudoreplay [-FhnRS] [-d dir] [-f filter] [-m num] [-s num] ID[@offset]\n\nsudoreplay [-h] [-d dir] -l [search expression]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "sudoreplay plays back or lists the output logs created by sudo.  When replaying, sudoreplay can\nplay the session back in real-time, or the playback speed may be adjusted (faster or slower)\nbased on the command line options.\n\nThe ID should either be a six character sequence of digits and upper case letters, e.g., 0100A5\nor a path name.  The ID may include an optional @offset suffix which may be used to start re‐\nplaying at a specific time offset.  The @offset is specified as a number in seconds since the\nstart of the session with an optional decimal fraction.\n\nPath names may be relative to the I/O log directory /var/log/sudo-io (unless overridden by the",
            "subsections": [
                {
                    "name": "-d",
                    "content": "with logoutput enabled in the sudoers file, a TSID=ID string is logged via syslog or to the\nsudo log file.  The ID may also be determined using sudoreplay's list mode.\n\nIn list mode, sudoreplay can be used to find the ID of a session based on a number of criteria\nsuch as the user, tty, or command run.\n\nIn replay mode, if the standard input and output are connected to a terminal and the -n option\nis not specified, sudoreplay will operate interactively.  In interactive mode, sudoreplay will\nattempt to adjust the terminal size to match that of the session and write directly to the ter‐\nminal (not all terminals support this).  Additionally, it will poll the keyboard and act on the\nfollowing keys:\n\n‘\\n’ or ‘\\r’  Skip to the next replay event; useful for long pauses.\n\n‘ ’ (space)   Pause output; press any key to resume.\n\n‘<’           Reduce the playback speed by one half.\n\n‘>’           Double the playback speed.\n\nThe session can be interrupted via control-C.  When the session has finished, the terminal is\nrestored to its original size if it was changed during playback.\n\nThe options are as follows:\n",
                    "flag": "-d"
                },
                {
                    "name": "-d --directory",
                    "content": "Store session logs in dir instead of the default, /var/log/sudo-io.\n",
                    "flag": "-d",
                    "long": "--directory"
                },
                {
                    "name": "-f --filter",
                    "content": "Select which I/O type(s) to display.  By default, sudoreplay will display the com‐\nmand's standard output, standard error, and tty output.  The filter argument is a\ncomma-separated list, consisting of one or more of following: stdin, stdout,\nstderr, ttyin, and ttyout.\n",
                    "flag": "-f",
                    "long": "--filter"
                },
                {
                    "name": "-F --follow",
                    "content": "Enable “follow mode”.  When replaying a session, sudoreplay will ignore end-of-file\nand keep replaying until the log is complete.  This can be used to replay a session\nthat is still in progress, similar to “tail -f”.  An I/O log file is considered to\nbe complete when the write bits have been cleared on the session's timing file.\nNote that versions of sudo prior to 1.9.1 do not clear the write bits upon comple‐\ntion.\n",
                    "flag": "-F",
                    "long": "--follow"
                },
                {
                    "name": "-h --help",
                    "content": "",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-l --list",
                    "content": "Enable “list mode”.  In this mode, sudoreplay will list available sessions in a\nformat similar to the sudo log file format, sorted by file name (or sequence num‐\nber).  Any control characters present in the log data are formatted in octal with a\nleading ‘#’ character.  For example, a horizontal tab is displayed as ‘#011’ and an\nembedded carriage return is displayed as ‘#015’.  Space characters in the command\nname and arguments are also formatted in octal.\n\nIf a search expression is specified, it will be used to restrict the IDs that are\ndisplayed.  An expression is composed of the following predicates:\n\ncommand pattern\nEvaluates to true if the command run matches the POSIX extended regular ex‐\npression pattern.\n\ncwd directory\nEvaluates to true if the command was run with the specified current working\ndirectory.\n\nfromdate date\nEvaluates to true if the command was run on or after date.  See Date and\ntime format for a description of supported date and time formats.\n\ngroup runasgroup\nEvaluates to true if the command was run with the specified runasgroup.\nNote that unless a runasgroup was explicitly specified when sudo was run\nthis field will be empty in the log.\n\nhost hostname\nEvaluates to true if the command was run on the specified hostname.\n\nrunas runasuser\nEvaluates to true if the command was run as the specified runasuser.  Note\nthat sudo runs commands as user root by default.\n\ntodate date\nEvaluates to true if the command was run on or prior to date.  See Date and\ntime format for a description of supported date and time formats.\n\ntty tty name\nEvaluates to true if the command was run on the specified terminal device.\nThe tty name should be specified without the /dev/ prefix, e.g., tty01 in‐\nstead of /dev/tty01.\n\nuser user name\nEvaluates to true if the ID matches a command run by user name.\n\nPredicates may be abbreviated to the shortest unique string.\n\nPredicates may be combined using and, or, and ! operators as well as ‘(’ and ‘)’\ngrouping (note that parentheses must generally be escaped from the shell).  The and\noperator is optional, adjacent predicates have an implied and unless separated by\nan or.\n",
                    "flag": "-l",
                    "long": "--list"
                },
                {
                    "name": "-m --max-wait",
                    "content": "Specify an upper bound on how long to wait between key presses or output data.  By\ndefault, sudoreplay will accurately reproduce the delays between key presses or\nprogram output.  However, this can be tedious when the session includes long\npauses.  When the -m option is specified, sudoreplay will limit these pauses to at\nmost maxwait seconds.  The value may be specified as a floating point number,\ne.g., 2.5.  A maxwait of zero or less will eliminate the pauses entirely.\n",
                    "flag": "-m",
                    "long": "--max-wait"
                },
                {
                    "name": "-n --non-interactive",
                    "content": "Do not prompt for user input or attempt to re-size the terminal.  The session is\nwritten to the standard output, not directly to the user's terminal.\n",
                    "flag": "-n",
                    "long": "--non-interactive"
                },
                {
                    "name": "-R --no-resize",
                    "content": "Do not attempt to re-size the terminal to match the terminal size of the session.\n",
                    "flag": "-R",
                    "long": "--no-resize"
                },
                {
                    "name": "-S --suspend-wait",
                    "content": "Wait while the command was suspended.  By default, sudoreplay will ignore the time\ninterval between when the command was suspended and when it was resumed.  If the -S\noption is specified, sudoreplay will wait instead.\n",
                    "flag": "-S",
                    "long": "--suspend-wait"
                },
                {
                    "name": "-s --speed",
                    "content": "This option causes sudoreplay to adjust the number of seconds it will wait between\nkey presses or program output.  This can be used to slow down or speed up the dis‐\nplay.  For example, a speedfactor of 2 would make the output twice as fast whereas\na speedfactor of .5 would make the output twice as slow.\n",
                    "flag": "-s",
                    "long": "--speed"
                },
                {
                    "name": "-V --version",
                    "content": "Print the sudoreplay versions version number and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                },
                {
                    "name": "Date and time format",
                    "content": "The time and date may be specified multiple ways, common formats include:\n\nHH:MM:SS am MM/DD/CCYY timezone\n24 hour time may be used in place of am/pm.\n\nHH:MM:SS am Month, Day Year timezone\n24 hour time may be used in place of am/pm, and month and day names may be abbreviated.\nNote that month and day of the week names must be specified in English.\n\nCCYY-MM-DD HH:MM:SS\nISO time format\n\nDD Month CCYY HH:MM:SS\nThe month name may be abbreviated.\n\nEither time or date may be omitted, the am/pm and timezone are optional.  If no date is speci‐\nfied, the current day is assumed; if no time is specified, the first second of the specified\ndate is used.  The less significant parts of both time and date may also be omitted, in which\ncase zero is assumed.\n\nThe following are all valid time and date specifications:\n\nnow     The current time and date.\n\ntomorrow\nExactly one day from now.\n\nyesterday\n24 hours ago.\n\n2 hours ago\n2 hours ago.\n\nnext Friday\nThe first second of the Friday in the next (upcoming) week.  Not to be confused with\n“this Friday” which would match the Friday of the current week.\n\nlast week\nThe current time but 7 days ago.  This is equivalent to “a week ago”.\n\na fortnight ago\nThe current time but 14 days ago.\n\n10:01 am 9/17/2009\n10:01 am, September 17, 2009.\n\n10:01 am\n10:01 am on the current day.\n\n10      10:00 am on the current day.\n\n9/17/2009\n00:00 am, September 17, 2009.\n\n10:01 am Sep 17, 2009\n10:01 am, September 17, 2009.\n\nNote that relative time specifications do not always work as expected.  For example, the “next”\nqualifier is intended to be used in conjunction with a day such as “next Monday”.  When used\nwith units of weeks, months, years, etc the result will be one more than expected.  For exam‐\nple, “next week” will result in a time exactly two weeks from now, which is probably not what\nwas intended.  This will be addressed in a future version of sudoreplay.\n"
                },
                {
                    "name": "Debugging sudoreplay",
                    "content": "sudoreplay versions 1.8.4 and higher support a flexible debugging framework that is configured\nvia Debug lines in the sudo.conf(5) file.\n\nFor more information on configuring sudo.conf(5), please refer to its manual.\n"
                }
            ]
        },
        "FILES": {
            "content": "/etc/sudo.conf            Debugging framework configuration\n\n/var/log/sudo-io          The default I/O log directory.\n\n/var/log/sudo-io/00/00/01/log\nExample session log info.\n\n/var/log/sudo-io/00/00/01/log.json\nExample session log info (JSON format).\n\n/var/log/sudo-io/00/00/01/stdin\nExample session standard input log.\n\n/var/log/sudo-io/00/00/01/stdout\nExample session standard output log.\n\n/var/log/sudo-io/00/00/01/stderr\nExample session standard error log.\n\n/var/log/sudo-io/00/00/01/ttyin\nExample session tty input file.\n\n/var/log/sudo-io/00/00/01/ttyout\nExample session tty output file.\n\n/var/log/sudo-io/00/00/01/timing\nExample session timing file.\n\nNote that the stdin, stdout and stderr files will be empty unless sudo was used as part of a\npipeline for a particular command.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "List sessions run by user millert:\n\n# sudoreplay -l user millert\n\nList sessions run by user bob with a command containing the string vi:\n\n# sudoreplay -l user bob command vi\n\nList sessions run by user jeff that match a regular expression:\n\n# sudoreplay -l user jeff command '/bin/[a-z]*sh'\n\nList sessions run by jeff or bob on the console:\n\n# sudoreplay -l ( user jeff or user bob ) tty console\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "script(1), sudo.conf(5), sudo(8)\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Many people have worked on sudo over the years; this version consists of code written primarily\nby:\n\nTodd C. Miller\n\nSee the CONTRIBUTORS file in the sudo distribution (https://www.sudo.ws/contributors.html) for\nan exhaustive list of people who have contributed to sudo.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "If you feel you have found a bug in sudoreplay, please submit a bug report at\nhttps://bugzilla.sudo.ws/\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Limited free support is available via the sudo-users mailing list, see\nhttps://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search the archives.\n",
            "subsections": []
        },
        "DISCLAIMER": {
            "content": "sudoreplay is provided “AS IS” and any express or implied warranties, including, but not lim‐\nited to, the implied warranties of merchantability and fitness for a particular purpose are\ndisclaimed.  See the LICENSE file distributed with sudo or https://www.sudo.ws/license.html for\ncomplete details.\n",
            "subsections": []
        },
        "Sudo 1.9.9                     January 19, 2022                     Sudo 1.9.9": {
            "content": "",
            "subsections": []
        }
    },
    "summary": "sudoreplay — replay sudo session logs",
    "flags": [
        {
            "flag": "-d",
            "long": null,
            "arg": null,
            "description": "with logoutput 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 ter‐ minal (not all terminals support this). Additionally, it will poll the keyboard and act on the following keys: ‘\\n’ or ‘\\r’ Skip to the next replay event; useful for long pauses. ‘ ’ (space) Pause output; press any key to resume. ‘<’ Reduce the playback speed by one half. ‘>’ Double the playback speed. 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:"
        },
        {
            "flag": "-d",
            "long": "--directory",
            "arg": null,
            "description": "Store session logs in dir instead of the default, /var/log/sudo-io."
        },
        {
            "flag": "-f",
            "long": "--filter",
            "arg": null,
            "description": "Select which I/O type(s) to display. By default, sudoreplay will display the com‐ mand's standard output, standard error, and tty output. The filter argument is a comma-separated list, consisting of one or more of following: stdin, stdout, stderr, ttyin, and ttyout."
        },
        {
            "flag": "-F",
            "long": "--follow",
            "arg": null,
            "description": "Enable “follow mode”. When replaying a session, sudoreplay will ignore end-of-file and keep replaying until the log is complete. This can be used to replay a session that is still in progress, similar to “tail -f”. An I/O log file is considered to be complete when the write bits have been cleared on the session's timing file. Note that versions of sudo prior to 1.9.1 do not clear the write bits upon comple‐ tion."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": ""
        },
        {
            "flag": "-l",
            "long": "--list",
            "arg": null,
            "description": "Enable “list mode”. In this mode, sudoreplay will list available sessions in a format similar to the sudo log file format, sorted by file name (or sequence num‐ ber). Any control characters present in the log data are formatted in octal with a leading ‘#’ character. For example, a horizontal tab is displayed as ‘#011’ and an embedded carriage return is displayed as ‘#015’. Space characters in the command name and arguments are also formatted in octal. 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: command pattern Evaluates to true if the command run matches the POSIX extended regular ex‐ pression pattern. cwd directory Evaluates to true if the command was run with the specified current working directory. fromdate date Evaluates to true if the command was run on or after date. See Date and time format for a description of supported date and time formats. group runasgroup Evaluates to true if the command was run with the specified runasgroup. Note that unless a runasgroup was explicitly specified when sudo was run this field will be empty in the log. host hostname Evaluates to true if the command was run on the specified hostname. runas runasuser Evaluates to true if the command was run as the specified runasuser. Note that sudo runs commands as user root by default. todate date Evaluates to true if the command was run on or prior to date. See Date and time format for a description of supported date and time formats. tty tty name Evaluates to true if the command was run on the specified terminal device. The tty name should be specified without the /dev/ prefix, e.g., tty01 in‐ stead of /dev/tty01. user user name Evaluates to true if the ID matches a command run by user name. Predicates may be abbreviated to the shortest unique string. Predicates may be combined using and, or, and ! operators as well as ‘(’ and ‘)’ 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 or."
        },
        {
            "flag": "-m",
            "long": "--max-wait",
            "arg": null,
            "description": "Specify an upper bound on how long to wait between key presses or output data. By default, sudoreplay will accurately reproduce the delays between key presses or program output. However, this can be tedious when the session includes long pauses. When the -m option is specified, sudoreplay will limit these pauses to at most maxwait seconds. The value may be specified as a floating point number, e.g., 2.5. A maxwait of zero or less will eliminate the pauses entirely."
        },
        {
            "flag": "-n",
            "long": "--non-interactive",
            "arg": null,
            "description": "Do not prompt for user input or attempt to re-size the terminal. The session is written to the standard output, not directly to the user's terminal."
        },
        {
            "flag": "-R",
            "long": "--no-resize",
            "arg": null,
            "description": "Do not attempt to re-size the terminal to match the terminal size of the session."
        },
        {
            "flag": "-S",
            "long": "--suspend-wait",
            "arg": null,
            "description": "Wait while the command was suspended. By default, sudoreplay will ignore the time interval between when the command was suspended and when it was resumed. If the -S option is specified, sudoreplay will wait instead."
        },
        {
            "flag": "-s",
            "long": "--speed",
            "arg": null,
            "description": "This option causes sudoreplay to 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 dis‐ play. For example, a speedfactor of 2 would make the output twice as fast whereas a speedfactor of .5 would make the output twice as slow."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Print the sudoreplay versions version number and exit."
        }
    ],
    "examples": [
        "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": [
        {
            "name": "script",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/script/1/json"
        },
        {
            "name": "sudo.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/sudo.conf/5/json"
        },
        {
            "name": "sudo",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sudo/8/json"
        }
    ]
}