{
    "mode": "man",
    "parameter": "SUDOREPLAY",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/SUDOREPLAY/8/json",
    "generated": "2026-11-08T01:36:52Z",
    "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\ncan play the session back in real-time, or the playback speed  may  be  adjusted  (faster  or\nslower) based on the command line options.\n\nThe  ID  should  either  be  a six character sequence of digits and upper case letters, e.g.,\n“0100A5” or a path name.  The ID may include an optional @offset suffix which may be used  to\nstart  replaying  at a specific time offset.  The @offset is specified as a number in seconds\nsince the start 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\nthe -d option) or fully qualified, beginning with a ‘/’ character.  When a command is run via\nsudo  with logoutput enabled in the sudoers file, a “TSID=ID” string is logged via syslog(3)\nor to the sudo 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  crite‐\nria such 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 op‐\ntion  is  not  specified,  sudoreplay  will  operate  interactively.   In  interactive  mode,\nsudoreplay  will  attempt  to adjust the terminal size to match that of the session and write\ndirectly to the terminal (not all terminals support this).  Additionally, it  will  poll  the\nkeyboard and act on the following 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",
            "subsections": [
                {
                    "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, stderr,\nttyin, 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 be\ncomplete when the write bits have been cleared on the session's  timing  file.   Ver‐\nsions of sudo prior to 1.9.1 do not clear the write bits upon completion.\n",
                    "flag": "-F",
                    "long": "--follow"
                },
                {
                    "name": "-h --help",
                    "content": "Display a short help message to the standard output and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-l --list",
                    "content": "Enable  “list mode”.  In this mode, sudoreplay will list available sessions in a for‐\nmat similar to the sudo log file format, sorted by file name  (or  sequence  number).\nAny  control characters present in the log data are formatted in octal with a leading\n‘#’ character.  For example, a horizontal tab is displayed as ‘#011’ and an  embedded\ncarriage return is displayed as ‘#015’.  Space characters in the command name and ar‐\nguments 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.  Un‐\nless a runasgroup was explicitly specified when sudo was run this field will\nbe 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.  By de‐\nfault, sudo runs commands as the root user.\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 (parentheses must generally be escaped from the shell).  The and operator is\noptional, adjacent predicates have an implied and unless separated by an 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  pro‐\ngram  output.   However,  this  can be tedious when the session includes long pauses.\nWhen the -m option is specified, sudoreplay  will  limit  these  pauses  to  at  most\nmaxwait  seconds.  The value may be specified as a floating point number, e.g., 2.5.\nA 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 a\nspeedfactor 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 abbrevi‐\nated.  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 spec‐\nified, 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\nRelative  time specifications do not always work as expected.  For example, the “next” quali‐\nfier is intended to be used in conjunction with a day such as “next Monday”.  When used  with\nunits  of  weeks, months, years, etc the result will be one more than expected.  For example,\n“next week” will result in a time exactly two weeks from now, which is probably not what  was\nintended.  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 config‐\nured via Debug lines in the sudo.conf(5) file.\n\nFor more information on configuring sudo.conf(5), 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\nThe stdin, stdout and stderr files will be empty unless sudo was used as part of  a  pipeline\nfor 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 primar‐\nily by:\n\nTodd C. Miller\n\nSee  the  CONTRIBUTORS.md  file in the sudo distribution (https://www.sudo.ws/about/contribu‐\ntors/) for an exhaustive list of people who have contributed to sudo.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "If you believe you have  found  a  bug  in  sudoreplay,  you  can  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.md file distributed with sudo or https://www.sudo.ws/about/li‐\ncense/ for complete details.\n\nSudo 1.9.15p5                             January 16, 2023                             SUDOREPLAY(8)",
            "subsections": []
        }
    },
    "summary": "sudoreplay — replay sudo session logs",
    "flags": [
        {
            "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. Ver‐ sions of sudo prior to 1.9.1 do not clear the write bits upon completion."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display a short help message to the standard output and exit."
        },
        {
            "flag": "-l",
            "long": "--list",
            "arg": null,
            "description": "Enable “list mode”. In this mode, sudoreplay will list available sessions in a for‐ mat similar to the sudo log file format, sorted by file name (or sequence number). 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 ar‐ guments 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. Un‐ less 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. By de‐ fault, sudo runs commands as the root user. 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 (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 pro‐ gram 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"
        }
    ]
}