svnserve

package: subversion-server-common

title: svnserve(8)

text:
# svnserve(8)

## NAME
svnserve - Server for the 'svn' repository access method

## SYNOPSIS
svnserve [options]

## DESCRIPTION
svnserve allows access to Subversion repositories using the svn network protocol. It can both run as a standalone server process, or it can run out of inetd. You must choose a mode of operation when you start svnserve. The following options are recognized:

-d, --daemon

Causes svnserve to run in daemon mode. svnserve backgrounds itself and accepts and serves TCP/IP connections on the svn port (3690, by default).

--listen-port=port

Causes svnserve to listen on port when run in daemon mode.

--listen-host=host

Causes svnserve to listen on the interface specified by host, which may be either a hostname or an IP address.

--foreground

When used together with -d, this option causes svnserve to stay in the foreground. This option is mainly useful for debugging.

-i, --inetd

Causes svnserve to use the stdin/stdout file descriptors, as is appropriate for a daemon running out of inetd.

-h, --help

Displays a usage summary and exits.

--version

Print svnserve's version and the repository filesystem back-end(s) a particular svnserve supports.

-r root, --root=root

Sets the virtual root for repositories served by svnserve. The pathname in URLs provided by the client will be interpreted relative to this root, and will not be allowed to escape this root.

-R --read-only

Force all write operations through this svnserve instance to be forbidden, overriding all other access policy configuration. Do not use this option to set general repository access policy - that is what the conf/svnserve.conf repository configuration file is for. This option should be used only to restrict access via a certain method of invoking svnserve - for example, to allow write access via SSH, but not via a svnserve daemon, or to create a restricted SSH key which is only capable of read access.

-t, --tunnel

Causes svnserve to run in tunnel mode, which is just like the inetd mode of operation (serve one connection over stdin/stdout) except that the connection is considered to be pre-authenticated with the username of the current uid. This flag is selected by the client when running over a tunnel agent.

--tunnel-user=username

When combined with --tunnel, overrides the pre-authenticated username with the supplied username. This is useful in combination with the ssh authorized_key file's "command" directive to allow a single system account to be used by multiple committers, each having a distinct ssh identity.

-T, --threads

When running in daemon mode, causes svnserve to spawn a thread instead of a process for each connection. The svnserve process still backgrounds itself at startup time.

--config-file=filename

When specified, svnserve reads filename once at program startup and caches the svnserve configuration. The password and authorization configurations referenced from filename will be loaded on each connection. svnserve will not read any per-repository conf/svnserve.conf files when this option is used. See the svnserve.conf(5) man page for details of the file format for this option.

--pid-file=filename

When specified, svnserve will write its process ID to filename.

-X, --listen-once

Causes svnserve to accept one connection on the svn port, serve it, and exit. This option is mainly useful for debugging.

Unless the --config-file option was specified on the command line, once the client has selected a repository by transmitting its URL, svnserve reads a file named conf/svnserve.conf in the repository directory to determine repository-specific settings such as what authentication database to use and what authorization policies to apply. See the svnserve.conf(5) man page for details of that file format.

## SEE ALSO
svnserve.conf(5)


sudo

package: sudo

title: sudo(8)

summary: execute a command as another user

text:
# sudo(8)

## NAME
sudo, sudoedit — execute a command as another user

## SYNOPSIS
sudo

-h | -K | -k | -V

sudo

-v [-ABkNnS] [-g group] [-h host] [-p prompt] [-u user]

sudo

-l [-ABkNnS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command [arg ...]]

sudo

[-ABbEHnPS] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-r role] [-t type] [-T timeout] [-u user] [VAR=value] [-i | -s] [command [arg ...]]

sudoedit

[-ABkNnS] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-r role] [-t type] [-T timeout] [-u user] file ...

## DESCRIPTION
sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy. The invoking user's real (not effective) user-ID is used to determine the user name with which to query the security policy.

sudo supports a plugin architecture for security policies, auditing, and input/output logging. Third parties can develop and distribute their own plugins to work seamlessly with the sudo front-end. The default security policy is sudoers, which is configured via the file /etc/sudoers, or via LDAP. See the Plugins section for more information.

The security policy determines what privileges, if any, a user has to run sudo. The policy may require that users authenticate themselves with a password or another authentication mechanism. If authentication is required, sudo will exit if the user's password is not entered within a configurable time limit. This limit is policy-specific; the default password prompt timeout for the sudoers security policy is 5 minutes.

Security policies may support credential caching to allow the user to run sudo again for a period of time without requiring authentication. By default, the sudoers policy caches credentials on a per-terminal basis for 5 minutes. See the timestamp_type and timestamp_timeout options in sudoers(5) for more information. By running sudo with the -v option, a user can update the cached credentials without running a command.

On systems where sudo is the primary method of gaining superuser privileges, it is imperative to avoid syntax errors in the security policy configuration files. For the default security policy, sudoers(5), changes to the configuration files should be made using the visudo(8) utility which will ensure that no syntax errors are introduced.

When invoked as sudoedit, the -e option (described below), is implied.

Security policies and audit plugins may log successful and failed attempts to run sudo. If an I/O plugin is configured, the running command's input and output may be logged as well.

The options are as follows:

-A, --askpass

Normally, if sudo requires a password, it will read it from the user's terminal. If the -A (askpass) option is specified, a (possibly graphical) helper program is executed to read the user's password and output the password to the standard output. If the SUDO_ASKPASS environment variable is set, it specifies the path to the helper program. Otherwise, if sudo.conf(5) contains a line specifying the askpass program, that value will be used. For example:

```
# Path to askpass helper program
Path askpass /usr/X11R6/bin/ssh-askpass
```

If no askpass program is available, sudo will exit with an error.

-B, --bell

Ring the bell as part of the password prompt when a terminal is present. This option has no effect if an askpass program is used.

-b, --background

Run the given command in the background. It is not possible to use shell job control to manipulate background processes started by sudo. Most interactive commands will fail to work properly in background mode.

-C num, --close-from=num

Close all file descriptors greater than or equal to num before executing a command. Values less than three are not permitted. By default, sudo will close all open file descriptors other than standard input, standard output, and standard error when executing a command. The security policy may restrict the user's ability to use this option. The sudoers policy only permits use of the -C option when the administrator has enabled the closefrom_override option.

-D directory, --chdir=directory

Run the command in the specified directory instead of the current working directory. The security policy may return an error if the user does not have permission to specify the working directory.

-E, --preserve-env

Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the user does not have permission to preserve the environment.

--preserve-env=list

Indicates to the security policy that the user wishes to add the comma-separated list of environment variables to those preserved from the user's environment. The security policy may return an error if the user does not have permission to preserve the environment. This option may be specified multiple times.

-e, --edit

Edit one or more files instead of running a command. In lieu of a path name, the string "sudoedit" is used when consulting the security policy. If the user is authorized by the policy, the following steps are taken:

- Temporary copies are made of the files to be edited with the owner set to the invoking user.

- The editor specified by the policy is run to edit the temporary files. The sudoers policy uses the SUDO_EDITOR, VISUAL and EDITOR environment variables (in that order). If none of SUDO_EDITOR, VISUAL or EDITOR are set, the first program listed in the editor sudoers(5) option is used.

- If they have been modified, the temporary files are copied back to their original location and the temporary versions are removed.

To help prevent the editing of unauthorized files, the following restrictions are enforced unless explicitly allowed by the security policy:

- Symbolic links may not be edited (version 1.8.15 and higher).

- Symbolic links along the path to be edited are not followed when the parent directory is writable by the invoking user unless that user is root (version 1.8.16 and higher).

- Files located in a directory that is writable by the invoking user may not be edited unless that user is root (version 1.8.16 and higher).

Users are never allowed to edit device special files.

If the specified file does not exist, it will be created. Unlike most commands run by sudo, the editor is run with the invoking user's environment unmodified. If the temporary file becomes empty after editing, the user will be prompted before it is installed. If, for some reason, sudo is unable to update a file with its edited version, the user will receive a warning and the edited copy will remain in a temporary file.

-g group, --group=group

Run the command with the primary group set to group instead of the primary group specified by the target user's password database entry. The group may be either a group name or a numeric group-ID (GID) prefixed with the ‘#’ character (e.g., ‘#0’ for GID 0). When running a command as a GID, many shells require that the ‘#’ be escaped with a backslash (‘\’). If no -u option is specified, the command will be run as the invoking user. In either case, the primary group will be set to group. The sudoers policy permits any of the target user's groups to be specified via the -g option as long as the -P option is not in use.

-H, --set-home

Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.

-h, --help

Display a short help message to the standard output and exit.

-h host, --host=host

Run the command on the specified host if the security policy plugin supports remote commands. The sudoers plugin does not currently support running remote commands. This may also be used in conjunction with the -l option to list a user's privileges for the remote host.

-i, --login

Run the shell specified by the target user's password database entry as a login shell. This means that login-specific resource files such as .profile, .bash_profile, or .login will be read by the shell. If a command is specified, it is passed to the shell as a simple command using the -c option. The command and any args are concatenated, separated by spaces, after escaping each character (including white space) with a backslash (‘\’) except for alphanumerics, underscores, hyphens, and dollar signs. If no command is specified, an interactive shell is executed. sudo attempts to change to that user's home directory before running the shell. The command is run with an environment similar to the one a user would receive at log in. Most shells behave differently when a command is specified as compared to an interactive session; consult the shell's manual for details. The Command environment section in the sudoers(5) manual documents how the -i option affects the environment in which a command is run when the sudoers policy is in use.

-K, --remove-timestamp

Similar to the -k option, except that it removes every cached credential for the user, regardless of the terminal or parent process ID. The next time sudo is run, a password must be entered if the security policy requires authentication. It is not possible to use the -K option in conjunction with a command or other option. This option does not require a password. Not all security policies support credential caching.

-k, --reset-timestamp

When used without a command, invalidates the user's cached credentials for the current session. The next time sudo is run in the session, a password must be entered if the security policy requires authentication. By default, the sudoers policy uses a separate record in the credential cache for each terminal (or parent process ID if no terminal is present). This prevents the -k option from interfering with sudo commands run in a different terminal session. See the timestamp_type option in sudoers(5) for more information. This option does not require a password, and was added to allow a user to revoke sudo permissions from a .logout file. When used in conjunction with a command or an option that may require a password, this option will cause sudo to ignore the user's cached credentials. As a result, sudo will prompt for a password (if one is required by the security policy) and will not update the user's cached credentials.

Not all security policies support credential caching.

-l, --list

If no command is specified, list the privileges for the invoking user (or the user specified by the -U option) on the current host. A longer list format is used if this option is specified multiple times and the security policy supports a verbose output format. If a command is specified and is permitted by the security policy for the invoking user (or the, user specified by the -U option) on the current host, the fully-qualified path to the command is displayed along with any args. If -l is specified more than once (and the security policy supports it), the matching rule is displayed in a verbose format along with the command. If a command is specified but not allowed by the policy, sudo will exit with a status value of 1.

-N, --no-update

Do not update the user's cached credentials, even if the user successfully authenticates. Unlike the -k flag, existing cached credentials are used if they are valid. To detect when the user's cached credentials are valid (or when no authentication is required), the following can be used:

```
sudo -Nnv
```

Not all security policies support credential caching.

-n, --non-interactive

Avoid prompting the user for input of any kind. If a password is required for the command to run, sudo will display an error message and exit.

-P, --preserve-groups

Preserve the invoking user's group vector unaltered. By default, the sudoers policy will initialize the group vector to the list of groups the target user is a member of. The real and effective group-IDs, however, are still set to match the target user.

-p prompt, --prompt=prompt

Use a custom password prompt with optional escape sequences. The following percent (‘%’) escape sequences are supported by the sudoers policy: %H

expanded to the host name including the domain name (only if the machine's host name is fully qualified or the fqdn option is set in sudoers(5))

%h

expanded to the local host name without the domain name

%p

expanded to the name of the user whose password is being requested (respects the rootpw, targetpw, and runaspw flags in sudoers(5))

%U

expanded to the login name of the user the command will be run as (defaults to root unless the -u option is also specified)

%u

expanded to the invoking user's login name

%%

two consecutive ‘%’ characters are collapsed into a single ‘%’ character

The custom prompt will override the default prompt specified by either the security policy or the SUDO_PROMPT environment variable. On systems that use PAM, the custom prompt will also override the prompt specified by a PAM module unless the passprompt_override flag is disabled in sudoers.

-R directory, --chroot=directory

Change to the specified root directory (see chroot(8)) before running the command. The security policy may return an error if the user does not have permission to specify the root directory. This option is deprecated and will be removed in a future version of sudo.

-r role, --role=role

Run the command with an SELinux security context that includes the specified role.

-S, --stdin

Write the prompt to the standard error and read the password from the standard input instead of using the terminal device.

-s, --shell

Run the shell specified by the SHELL environment variable if it is set or the shell specified by the invoking user's password database entry. If a command is specified, it is passed to the shell as a simple command using the -c option. The command and any args are concatenated, separated by spaces, after escaping each character (including white space) with a backslash (‘\’) except for alphanumerics, underscores, hyphens, and dollar signs. If no command is specified, an interactive shell is executed. Most shells behave differently when a command is specified as compared to an interactive session; consult the shell's manual for details.

-t type, --type=type

Run the command with an SELinux security context that includes the specified type. If no type is specified, the default type is derived from the role.

-U user, --other-user=user

Used in conjunction with the -l option to list the privileges for user instead of for the invoking user. The security policy may restrict listing other users' privileges. When using the sudoers policy, the -U option is restricted to the root user and users with either the “list” priviege for the specified user or the ability to run any command as root or user on the current host.

-T timeout, --command-timeout=timeout

Used to set a timeout for the command. If the timeout expires before the command has exited, the command will be terminated. The security policy may restrict the user's ability to set timeouts. The sudoers policy requires that user-specified timeouts be explicitly enabled.

-u user, --user=user

Run the command as a user other than the default target user (usually root). The user may be either a user name or a numeric user-ID (UID) prefixed with the ‘#’ character (e.g., ‘#0’ for UID 0). When running commands as a UID, many shells require that the ‘#’ be escaped with a backslash (‘\’). Some security policies may restrict UIDs to those listed in the password database. The sudoers policy allows UIDs that are not in the password database as long as the targetpw option is not set. Other security policies may not support this.

-V, --version

Print the sudo version string as well as the version string of any configured plugins. If the invoking user is already root, the -V option will display the options passed to configure when sudo was built; plugins may display additional information such as default options.

-v, --validate

Update the user's cached credentials, authenticating the user if necessary. For the sudoers plugin, this extends the sudo timeout for another 5 minutes by default, but does not run a command. Not all security policies support cached credentials.

--

The -- is used to delimit the end of the sudo options. Subsequent options are passed to the command.

Options that take a value may only be specified once unless otherwise indicated in the description. This is to help guard against problems caused by poorly written scripts that invoke sudo with user-controlled input.

Environment variables to be set for the command may also be passed as options to sudo in the form VAR=value, for example LD_LIBRARY_PATH=/usr/local/pkg/lib. Environment variables may be subject to restrictions imposed by the security policy plugin. The sudoers policy subjects environment variables passed as options to the same restrictions as existing environment variables with one important difference. If the setenv option is set in sudoers, the command to be run has the SETENV tag set or the command matched is ALL, the user may set variables that would otherwise be forbidden. See sudoers(5) for more information.

## COMMAND EXECUTION
When sudo executes a command, the security policy specifies the execution environment for the command. Typically, the real and effective user and group and IDs are set to match those of the target user, as specified in the password database, and the group vector is initialized based on the group database (unless the -P option was specified).

The following parameters may be specified by security policy:

- real and effective user-ID

- real and effective group-ID

- supplementary group-IDs

- the environment list

- current working directory

- file creation mode mask (umask)

- SELinux role and type

- scheduling priority (aka nice value)

### Process model
There are two distinct ways sudo can run a command.

If an I/O logging plugin is configured to log terminal I/O, or if the security policy explicitly requests it, a new pseudo-terminal (“pty”) is allocated and fork(2) is used to create a second sudo process, referred to as the monitor. The monitor creates a new terminal session with itself as the leader and the pty as its controlling terminal, calls fork(2) again, sets up the execution environment as described above, and then uses the execve(2) system call to run the command in the child process. The monitor exists to relay job control signals between the user's terminal and the pty the command is being run in. This makes it possible to suspend and resume the command normally. Without the monitor, the command would be in what POSIX terms an “orphaned process group” and it would not receive any job control signals from the kernel. When the command exits or is terminated by a signal, the monitor passes the command's exit status to the main sudo process and exits. After receiving the command's exit status, the main sudo process passes the command's exit status to the security policy's close function, as well as the close function of any configured audit plugin, and exits. This mode is the default for sudo versions 1.9.14 and above when using the sudoers policy.

If no pty is used, sudo calls fork(2), sets up the execution environment as described above, and uses the execve(2) system call to run the command in the child process. The main sudo process waits until the command has completed, then passes the command's exit status to the security policy's close function, as well as the close function of any configured audit plugins, and exits. As a special case, if the policy plugin does not define a close function, sudo will execute the command directly instead of calling fork(2) first. The sudoers policy plugin will only define a close function when I/O logging is enabled, a pty is required, an SELinux role is specified, the command has an associated timeout, or the pam_session or pam_setcred options are enabled. Both pam_session and pam_setcred are enabled by default on systems using PAM. This mode is the default for sudo versions prior to 1.9.14 when using the sudoers policy.

On systems that use PAM, the security policy's close function is responsible for closing the PAM session. It may also log the command's exit status.

### Signal handling
When the command is run as a child of the sudo process, sudo will relay signals it receives to the command. The SIGINT and SIGQUIT signals are only relayed when the command is being run in a new pty or when the signal was sent by a user process, not the kernel. This prevents the command from receiving SIGINT twice each time the user enters control-C. Some signals, such as SIGSTOP and SIGKILL, cannot be caught and thus will not be relayed to the command. As a general rule, SIGTSTP should be used instead of SIGSTOP when you wish to suspend a command being run by sudo.

As a special case, sudo will not relay signals that were sent by the command it is running. This prevents the command from accidentally killing itself. On some systems, the reboot(8) utility sends SIGTERM to all non-system processes other than itself before rebooting the system. This prevents sudo from relaying the SIGTERM signal it received back to reboot(8), which might then exit before the system was actually rebooted, leaving it in a half-dead state similar to single user mode. Note, however, that this check only applies to the command run by sudo and not any other processes that the command may create. As a result, running a script that calls reboot(8) or shutdown(8) via sudo may cause the system to end up in this undefined state unless the reboot(8) or shutdown(8) are run using the exec() family of functions instead of system() (which interposes a shell between the command and the calling process).

### Plugins
Plugins may be specified via Plugin directives in the sudo.conf(5) file. They may be loaded as dynamic shared objects (on systems that support them), or compiled directly into the sudo binary. If no sudo.conf(5) file is present, or if it doesn't contain any Plugin lines, sudo will use sudoers(5) for the policy, auditing, and I/O logging plugins. See the sudo.conf(5) manual for details of the /etc/sudo.conf file and the sudo_plugin(5) manual for more information about the sudo plugin architecture.

## EXIT VALUE
Upon successful execution of a command, the exit status from sudo will be the exit status of the program that was executed. If the command terminated due to receipt of a signal, sudo will send itself the same signal that terminated the command.

If the -l option was specified without a command, sudo will exit with a value of 0 if the user is allowed to run sudo and they authenticated successfully (as required by the security policy). If a command is specified with the -l option, the exit value will only be 0 if the command is permitted by the security policy, otherwise it will be 1.

If there is an authentication failure, a configuration/permission problem, or if the given command cannot be executed, sudo exits with a value of 1. In the latter case, the error string is printed to the standard error. If sudo cannot stat(2) one or more entries in the user's PATH, an error is printed to the standard error. (If the directory does not exist or if it is not really a directory, the entry is ignored and no error is printed.) This should not happen under normal circumstances. The most common reason for stat(2) to return “permission denied” is if you are running an automounter and one of the directories in your PATH is on a machine that is currently unreachable.

## SECURITY NOTES
sudo tries to be safe when executing external commands.

To prevent command spoofing, sudo checks "." and "" (both denoting current directory) last when searching for a command in the user's PATH (if one or both are in the PATH). Depending on the security policy, the user's PATH environment variable may be modified, replaced, or passed unchanged to the program that sudo executes.

Users should never be granted sudo privileges to execute files that are writable by the user or that reside in a directory that is writable by the user. If the user can modify or replace the command there is no way to limit what additional commands they can run.

By default, sudo will only log the command it explicitly runs. If a user runs a command such as ‘sudo su’ or ‘sudo sh’, subsequent commands run from that shell are not subject to sudo's security policy. The same is true for commands that offer shell escapes (including most editors). If I/O logging is enabled, subsequent commands will have their input and/or output logged, but there will not be traditional logs for those commands. Because of this, care must be taken when giving users access to commands via sudo to verify that the command does not inadvertently give the user an effective root shell. For information on ways to address this, see the Preventing shell escapes section in sudoers(5).

To prevent the disclosure of potentially sensitive information, sudo disables core dumps by default while it is executing (they are re-enabled for the command that is run). This historical practice dates from a time when most operating systems allowed set-user-ID processes to dump core by default. To aid in debugging sudo crashes, you may wish to re-enable core dumps by setting “disable_coredump” to false in the sudo.conf(5) file as follows:

```
Set disable_coredump false
```

See the sudo.conf(5) manual for more information.

## ENVIRONMENT
sudo utilizes the following environment variables. The security policy has control over the actual content of the command's environment.

EDITOR

Default editor to use in -e (sudoedit) mode if neither SUDO_EDITOR nor VISUAL is set.

MAIL

Set to the mail spool of the target user when the -i option is specified, or when env_reset is enabled in sudoers (unless MAIL is present in the env_keep list).

HOME

Set to the home directory of the target user when the -i or -H options are specified, when the -s option is specified and set_home is set in sudoers, when always_set_home is enabled in sudoers, or when env_reset is enabled in sudoers and HOME is not present in the env_keep list.

LOGNAME

Set to the login name of the target user when the -i option is specified, when the set_logname option is enabled in sudoers, or when the env_reset option is enabled in sudoers (unless LOGNAME is present in the env_keep list).

PATH

May be overridden by the security policy.

SHELL

Used to determine shell to run with -s option.

SUDO_ASKPASS

Specifies the path to a helper program used to read the password if no terminal is available or if the -A option is specified.

SUDO_COMMAND

Set to the command run by sudo, including any args. The args are truncated at 4096 characters to prevent a potential execution error.

SUDO_EDITOR

Default editor to use in -e (sudoedit) mode.

SUDO_GID

Set to the group-ID of the user who invoked sudo.

SUDO_HOME

Set to the home directory of the user who invoked sudo.

SUDO_PROMPT

Used as the default password prompt unless the -p option was specified.

SUDO_PS1

If set, PS1 will be set to its value for the program being run.

SUDO_TTY

Set to the terminal device of the user who invoked sudo, if one is present.

SUDO_UID

Set to the user-ID of the user who invoked sudo.

SUDO_USER

Set to the login name of the user who invoked sudo.

USER

Set to the same value as LOGNAME, described above.

VISUAL

Default editor to use in -e (sudoedit) mode if SUDO_EDITOR is not set.

## FILES
/etc/sudo.conf

sudo front-end configuration

## EXAMPLES
The following examples assume a properly configured security policy.

To get a file listing of an unreadable directory:

```
$ sudo ls /usr/local/protected
```

To list the home directory of user yaz on a machine where the file system holding ~yaz is not exported as root:

```
$ sudo -u yaz ls ~yaz
```

To edit the index.html file as user www:

```
$ sudoedit -u www ~www/htdocs/index.html
```

To view system logs only accessible to root and users in the adm group:

```
$ sudo -g adm more /var/log/syslog
```

To run an editor as jim with a different primary group:

```
$ sudoedit -u jim -g audio ~jim/sound.txt
```

To shut down a machine:

```
$ sudo shutdown -r +15 "quick reboot"
```

To make a usage listing of the directories in the /home partition. The commands are run in a sub-shell to allow the ‘cd’ command and file redirection to work.

```
$ sudo sh -c "cd /home ; du -s * | sort -rn > USAGE"
```

## DIAGNOSTICS
Error messages produced by sudo include:

editing files in a writable directory is not permitted

By default, sudoedit does not permit editing a file when any of the parent directories are writable by the invoking user. This avoids a race condition that could allow the user to overwrite an arbitrary file. See the sudoedit_checkdir option in sudoers(5) for more information.

editing symbolic links is not permitted

By default, sudoedit does not follow symbolic links when opening files. See the sudoedit_follow option in sudoers(5) for more information.

effective uid is not 0, is sudo installed setuid root?

sudo was not run with root privileges. The sudo binary must be owned by the root user and have the set-user-ID bit set. Also, it must not be located on a file system mounted with the ‘nosuid’ option or on an NFS file system that maps uid 0 to an unprivileged uid.

effective uid is not 0, is sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

sudo was not run with root privileges. The sudo binary has the proper owner and permissions but it still did not run with root privileges. The most common reason for this is that the file system the sudo binary is located on is mounted with the ‘nosuid’ option or it is an NFS file system that maps uid 0 to an unprivileged uid.

fatal error, unable to load plugins

An error occurred while loading or initializing the plugins specified in sudo.conf(5).

invalid environment variable name

One or more environment variable names specified via the -E option contained an equal sign (‘=’). The arguments to the -E option should be environment variable names without an associated value.

no password was provided

When sudo tried to read the password, it did not receive any characters. This may happen if no terminal is available (or the -S option is specified) and the standard input has been redirected from /dev/null.

a terminal is required to read the password

sudo needs to read the password but there is no mechanism available for it to do so. Remote commands run via ssh(1) do not have a terminal available by default; passing the -t option to ssh(1) will cause it to allocate a terminal which should allow sudo to read the password. To allow sudo to run local commands without a terminal, the -S option can be used to read a password from the standard input, or an askpass helper can be configured via either the sudo.conf(5) file or by setting the SUDO_ASKPASS environment variable.

no writable temporary directory found

sudoedit was unable to find a usable temporary directory in which to store its intermediate files.

The “no new privileges” flag is set, which prevents sudo from running as root.

sudo was run by a process that has the Linux “no new privileges” flag is set. This causes the set-user-ID bit to be ignored when running an executable, which will prevent sudo from functioning. The most likely cause for this is running sudo within a container that sets this flag. Check the documentation to see if it is possible to configure the container such that the flag is not set.

sudo must be owned by uid 0 and have the setuid bit set

sudo was not run with root privileges. The sudo binary does not have the correct owner or permissions. It must be owned by the root user and have the set-user-ID bit set.

sudoedit is not supported on this platform

It is only possible to run sudoedit on systems that support setting the effective user-ID.

timed out reading password

The user did not enter a password before the password timeout (5 minutes by default) expired.

you do not exist in the passwd database

Your user-ID does not appear in the system passwd database.

you may not specify environment variables in edit mode

It is only possible to specify environment variables when running a command. When editing a file, the editor is run with the user's environment unmodified.

## SEE ALSO
su(1), stat(2), login_cap(3), passwd(5), sudo.conf(5), sudo_plugin(5), sudoers(5), sudoers_timestamp(5), sudoreplay(8), visudo(8)

## HISTORY
See the HISTORY.md file in the sudo distribution (https://www.sudo.ws/about/history/) for a brief history of sudo.

## AUTHORS
Many people have worked on sudo over the years; this version consists of code written primarily by:

Todd C. Miller

See the CONTRIBUTORS.md file in the sudo distribution (https://www.sudo.ws/about/contributors/) for an exhaustive list of people who have contributed to sudo.

## CAVEATS
There is no easy way to prevent a user from gaining a root shell if that user is allowed to run arbitrary commands via sudo. Also, many programs (such as editors) allow the user to run commands via shell escapes, thus avoiding sudo's checks. However, on most systems it is possible to prevent shell escapes with the sudoers(5) plugin's noexec functionality.

It is not meaningful to run the ‘cd’ command directly via sudo, e.g.,

```
$ sudo cd /usr/local/protected
```

since when the command exits the parent process (your shell) will still be the same. The -D option can be used to run a command in a specific directory.

Running shell scripts via sudo can expose the same kernel bugs that make set-user-ID shell scripts unsafe on some operating systems (if your OS has a /dev/fd/ directory, set-user-ID shell scripts are generally safe).

## BUGS
If you believe you have found a bug in sudo, you can either file a bug report in the sudo bug database, https://bugzilla.sudo.ws/, or open an issue at https://github.com/sudo-project/sudo/issues. If you would prefer to use email, messages may be sent to the sudo-workers mailing list, https://www.sudo.ws/mailman/listinfo/sudo-workers (public) or <sudo@sudo.ws> (private).

Please do not report security vulnerabilities through public GitHub issues, Bugzilla or mailing lists. Instead, report them via email to <Todd.Miller@sudo.ws>. You may encrypt your message with PGP if you would like, using the key found at https://www.sudo.ws/dist/PGPKEYS.

## SUPPORT
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.

## DISCLAIMER
sudo 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.md file distributed with sudo or https://www.sudo.ws/about/license/ for complete details.

branch: sisyphus


sudoreplay

title: sudoreplay(8)

summary: replay sudo session logs

text:
# sudoreplay(8)

## 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
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 path name. The ID may include an optional @offset suffix which may be used to start replaying at a specific time offset. The @offset is specified as a number in seconds since the start of the session with an optional decimal fraction.

Path names may be relative to the I/O log directory /var/log/sudo-io (unless overridden by the -d option) or fully qualified, beginning with a ‘/’ character. When a command is run via sudo with log_output enabled in the sudoers file, a “TSID=ID” string is logged via syslog(3) 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:

‘\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:

-d dir, --directory=dir

Store session logs in dir instead of the default, /var/log/sudo-io.

-f filter, --filter=filter

Select which I/O type(s) to display. By default, sudoreplay will 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: stdin, stdout, stderr, ttyin, and ttyout.

-F, --follow

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. Versions of sudo prior to 1.9.1 do not clear the write bits upon completion.

-h, --help

Display a short help message to the standard output and exit.

-l, --list [search expression]

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 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 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 expression 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 runas_group

Evaluates to true if the command was run with the specified runas_group. Unless a runas_group 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 runas_user

Evaluates to true if the command was run as the specified runas_user. By default, 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 instead 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.

-m, --max-wait max_wait

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 max_wait seconds. The value may be specified as a floating point number, e.g., 2.5. A max_wait of zero or less will eliminate the pauses entirely.

-n, --non-interactive

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.

-R, --no-resize

Do not attempt to re-size the terminal to match the terminal size of the session.

-S, --suspend-wait

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.

-s, --speed speed_factor

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 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.

-V, --version

Print the sudoreplay versions version number and exit.

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

HH:MM:SS am MM/DD/CCYY timezone

24 hour time may be used in place of am/pm.

HH:MM:SS am Month, Day Year timezone

24 hour time may be used in place of am/pm, and month and day names may be abbreviated. Month and day of the week names must be specified in English.

CCYY-MM-DD HH:MM:SS

ISO time format

DD Month CCYY HH:MM:SS

The month name may be abbreviated.

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:

now

The current time and date.

tomorrow

Exactly one day from now.

yesterday

24 hours ago.

2 hours ago

2 hours ago.

next Friday

The first second of the Friday in the next (upcoming) week. Not to be confused with “this Friday” which would match the Friday of the current week.

last week

The current time but 7 days ago. This is equivalent to “a week ago”.

a fortnight ago

The current time but 14 days ago.

10:01 am 9/17/2009

10:01 am, September 17, 2009.

10:01 am

10:01 am on the current day.

10

10:00 am on the current day.

9/17/2009

00:00 am, September 17, 2009.

10:01 am Sep 17, 2009

10:01 am, September 17, 2009.

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 sudoreplay.

### 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), refer to its manual.

## FILES
/etc/sudo.conf

Debugging framework configuration

/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 (JSON format).

/var/log/sudo-io/00/00/01/stdin

Example session standard input log.

/var/log/sudo-io/00/00/01/stdout

Example session standard output log.

/var/log/sudo-io/00/00/01/stderr

Example session standard error log.

/var/log/sudo-io/00/00/01/ttyin

Example session tty input file.

/var/log/sudo-io/00/00/01/ttyout

Example session tty output file.

/var/log/sudo-io/00/00/01/timing

Example session timing file.

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

## 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
script(1), sudo.conf(5), sudo(8)

## AUTHORS
Many people have worked on sudo over the years; this version consists of code written primarily by:

Todd C. Miller

See the CONTRIBUTORS.md file in the sudo distribution (https://www.sudo.ws/about/contributors/) for an exhaustive list of people who have contributed to sudo.

## BUGS
If you believe you have found a bug in sudoreplay, you can either file a bug report in the sudo bug database, https://bugzilla.sudo.ws/, or open an issue at https://github.com/sudo-project/sudo/issues. If you would prefer to use email, messages may be sent to the sudo-workers mailing list, https://www.sudo.ws/mailman/listinfo/sudo-workers (public) or <sudo@sudo.ws> (private).

Please do not report security vulnerabilities through public GitHub issues, Bugzilla or mailing lists. Instead, report them via email to <Todd.Miller@sudo.ws>. You may encrypt your message with PGP if you would like, using the key found at https://www.sudo.ws/dist/PGPKEYS.

## SUPPORT
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.

## 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. See the LICENSE.md file distributed with sudo or https://www.sudo.ws/about/license/ for complete details.


visudo

title: visudo(8)

summary: edit the sudoers file

text:
# visudo(8)

## NAME
visudo — edit the sudoers file

## SYNOPSIS
visudo

[-chIOPqsV] [[-f] sudoers]

## DESCRIPTION
visudo edits the sudoers file in a safe fashion, analogous to vipw(8). visudo locks the sudoers file against multiple simultaneous edits, performs basic validity checks, and checks for syntax errors before installing the edited file. If the sudoers file is currently being edited you will receive a message to try again later.

If the sudoers file does not exist, it will be created unless the editor exits without writing to the file.

visudo parses the sudoers file after editing and will not save the changes if there is a syntax error. Upon finding an error, visudo will print a message stating the line number(s) where the error occurred and the user will receive the “What now?” prompt. At this point the user may enter ‘e’ to re-edit the sudoers file, ‘x’ to exit without saving the changes, or ‘Q’ to quit and save changes. The ‘Q’ option should be used with extreme caution because if visudo believes there to be a syntax error, so will sudo. If ‘e’ is typed to edit the sudoers file after a syntax error has been detected, the cursor will be placed on the line where the error occurred (if the editor supports this feature).

There are two sudoers settings that determine which editor visudo will run.

editor

A colon (‘:’) separated list of editors allowed to be used with visudo. visudo will choose the editor that matches the user's SUDO_EDITOR, VISUAL, or EDITOR environment variable if possible, or the first editor in the list that exists and is executable. sudo does not preserve the SUDO_EDITOR, VISUAL, or EDITOR environment variables unless they are present in the env_keep list or the env_reset option is disabled in the sudoers file. The default editor path is /bin/vitmp which can be set at compile time via the --with-editor configure option.

env_editor

If set, visudo will use the value of the SUDO_EDITOR, VISUAL, or EDITOR environment variables before falling back on the default editor list. visudo is typically run as root so this option may allow a user with visudo privileges to run arbitrary commands as root without logging. An alternative is to place a colon-separated list of “safe” editors in the editor variable. visudo will then only use SUDO_EDITOR, VISUAL, or EDITOR if they match a value specified in editor. If the env_reset flag is enabled, the SUDO_EDITOR, VISUAL, and/or EDITOR environment variables must be present in the env_keep list for the env_editor flag to function when visudo is invoked via sudo. The default value is on, which can be set at compile time via the --with-env-editor configure option.

The options are as follows:

-c, --check

Enable check-only mode. The existing sudoers file (and any other files it includes) will be checked for syntax errors. If the path to the sudoers file was not specified, visudo will also check the file ownership and permissions (see the -O and -P options). A message will be printed to the standard output describing the status of sudoers unless the -q option was specified. If the check completes successfully, visudo will exit with a value of 0. If an error is encountered, visudo will exit with a value of 1.

-f sudoers, --file=sudoers

Specify an alternate sudoers file location, see below. As of version 1.8.27, the sudoers path can be specified without using the -f option.

-h, --help

Display a short help message to the standard output and exit.

-I, --no-includes

Disable the editing of include files unless there is a pre-existing syntax error. By default, visudo will edit the main sudoers file and any files included via @include or #include directives. Files included via @includedir or #includedir are never edited unless they contain a syntax error.

-O, --owner

Enforce the default ownership (user and group) of the sudoers file. In edit mode, the owner of the edited file will be set to the default. In check mode (-c), an error will be reported if the owner is incorrect. This option is enabled by default if the sudoers file was not specified.

-P, --perms

Enforce the default permissions (mode) of the sudoers file. In edit mode, the permissions of the edited file will be set to the default. In check mode (-c), an error will be reported if the file permissions are incorrect. This option is enabled by default if the sudoers file was not specified.

-q, --quiet

Enable quiet mode. In this mode details about syntax errors are not printed. This option is only useful when combined with the -c option.

-s, --strict

Enable strict checking of the sudoers file. If an alias is referenced but not actually defined or if there is a cycle in an alias, visudo will consider this a syntax error. It is not possible to differentiate between an alias and a host name or user name that consists solely of uppercase letters, digits, and the underscore (‘_’) character.

-V, --version

Print the visudo and sudoers grammar versions and exit.

A sudoers file may be specified instead of the default, /etc/sudoers. The temporary file used is the specified sudoers file with “.tmp” appended to it. In check-only mode only, ‘-’ may be used to indicate that sudoers will be read from the standard input. Because the policy is evaluated in its entirety, it is not sufficient to check an individual sudoers include file for syntax errors.

### Debugging and sudoers plugin arguments
visudo versions 1.8.4 and higher support a flexible debugging framework that is configured via Debug lines in the sudo.conf(5) file.

Starting with sudo 1.8.12, visudo will also parse the arguments to the sudoers plugin to override the default sudoers path name, user-ID, group-ID, and file mode. These arguments, if present, should be listed after the path to the plugin (i.e., after sudoers.so). Multiple arguments may be specified, separated by white space. For example:

```
Plugin sudoers_policy sudoers.so sudoers_mode=0400
```

The following arguments are supported:

sudoers_file=pathname

The sudoers_file argument can be used to override the default path to the sudoers file.

sudoers_uid=user-ID

The sudoers_uid argument can be used to override the default owner of the sudoers file. It should be specified as a numeric user-ID.

sudoers_gid=group-ID

The sudoers_gid argument can be used to override the default group of the sudoers file. It must be specified as a numeric group-ID (not a group name).

sudoers_mode=mode

The sudoers_mode argument can be used to override the default file mode for the sudoers file. It should be specified as an octal value.

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

## ENVIRONMENT
The following environment variables may be consulted depending on the value of the editor and env_editor sudoers settings:

SUDO_EDITOR

Invoked by visudo as the editor to use

VISUAL

Used by visudo if SUDO_EDITOR is not set

EDITOR

Used by visudo if neither SUDO_EDITOR nor VISUAL is set

## FILES
/etc/sudo.conf

Sudo front-end configuration

/etc/sudoers

List of who can run what

/etc/sudoers.tmp

Default temporary file used by visudo

## DIAGNOSTICS
In addition to reporting sudoers syntax errors, visudo may produce the following messages:

sudoers file busy, try again later.

Someone else is currently editing the sudoers file.

/etc/sudoers: Permission denied

You didn't run visudo as root.

you do not exist in the passwd database

Your user-ID does not appear in the system passwd database.

Warning: {User,Runas,Host,Cmnd}_Alias referenced but not defined

Either you are trying to use an undeclared {User,Runas,Host,Cmnd}_Alias or you have a user or host name listed that consists solely of uppercase letters, digits, and the underscore (‘_’) character. In the latter case, you can ignore the warnings (sudo will not complain). The message is prefixed with the path name of the sudoers file and the line number where the undefined alias was used. In -s (strict) mode these are errors, not warnings.

Warning: unused {User,Runas,Host,Cmnd}_Alias

The specified {User,Runas,Host,Cmnd}_Alias was defined but never used. The message is prefixed with the path name of the sudoers file and the line number where the unused alias was defined. You may wish to comment out or remove the unused alias.

Warning: cycle in {User,Runas,Host,Cmnd}_Alias

The specified {User,Runas,Host,Cmnd}_Alias includes a reference to itself, either directly or through an alias it includes. The message is prefixed with the path name of the sudoers file and the line number where the cycle was detected. This is only a warning unless visudo is run in -s (strict) mode as sudo will ignore cycles when parsing the sudoers file.

ignoring editor backup file

While processing a @includedir or #includedir, a file was found with a name that ends in ‘~’ or .bak. Such files are skipped by sudo and visudo.

ignoring file name containing '.'

While processing a @includedir or #includedir, a file was found with a name that contains a ‘.’ character. Such files are skipped by sudo and visudo.

unknown defaults entry "name"

The sudoers file contains a Defaults setting not recognized by visudo.

## SEE ALSO
vi(1), sudo.conf(5), sudoers(5), sudo(8), vipw(8)

## AUTHORS
Many people have worked on sudo over the years; this version consists of code written primarily by:

Todd C. Miller

See the CONTRIBUTORS.md file in the sudo distribution (https://www.sudo.ws/about/contributors/) for an exhaustive list of people who have contributed to sudo.

## CAVEATS
There is no easy way to prevent a user from gaining a root shell if the editor used by visudo allows shell escapes.

## BUGS
If you believe you have found a bug in visudo, you can either file a bug report in the sudo bug database, https://bugzilla.sudo.ws/, or open an issue at https://github.com/sudo-project/sudo/issues. If you would prefer to use email, messages may be sent to the sudo-workers mailing list, https://www.sudo.ws/mailman/listinfo/sudo-workers (public) or <sudo@sudo.ws> (private).

Please do not report security vulnerabilities through public GitHub issues, Bugzilla or mailing lists. Instead, report them via email to <Todd.Miller@sudo.ws>. You may encrypt your message with PGP if you would like, using the key found at https://www.sudo.ws/dist/PGPKEYS.

## SUPPORT
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.

## DISCLAIMER
visudo 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.md file distributed with sudo or https://www.sudo.ws/about/license/ for complete details.


package: sudo-logsrvd

title: sudo_logsrvd(8)

summary: sudo event and I/O log server

text:
# sudo_logsrvd(8)

## NAME
sudo_logsrvd — sudo event and I/O log server

## SYNOPSIS
sudo_logsrvd

[-hnV] [-f file] [-R percentage]

## DESCRIPTION
sudo_logsrvd is a high-performance log server that accepts event and I/O logs from sudo. It can be used to implement centralized logging of sudo logs. The server has two modes of operation: local and relay. By default, sudo_logsrvd stores the logs locally but it can also be configured to relay them to another server that supports the sudo_logsrv.proto(5) protocol.

When not relaying, event log entries may be logged either via syslog(3) or to a local file. I/O Logs stored locally by sudo_logsrvd can be replayed via the sudoreplay(8) utility in the same way as logs generated directly by the sudoers plugin.

The server also supports restarting interrupted log transfers. To distinguish completed I/O logs from incomplete ones, the I/O log timing file is set to be read-only when the log is complete.

Configuration parameters for sudo_logsrvd may be specified in the sudo_logsrvd.conf(5) file or the file specified via the -f option.

sudo_logsrvd rereads its configuration file when it receives SIGHUP and writes server state to the debug file (if one is configured) when it receives SIGUSR1.

The options are as follows:

-f file, --file=file

Read configuration from file instead of the default, /etc/sudo_logsrvd.conf.

-h, --help

Display a short help message to the standard output and exit.

-n, --no-fork

Run sudo_logsrvd in the foreground instead of detaching from the terminal and becoming a daemon.

-R percentage, --random-drop=percentage

For each message, there is a percentage chance that the server will drop the connection. This is only intended for debugging the ability of a client to restart a connection.

-V, --version

Print the sudo_logsrvd version and exit.

### Securing server connections
The I/O log data sent to sudo_logsrvd may contain sensitive information such as passwords and should be secured using Transport Layer Security (TLS). Doing so requires having a signed certificate on the server and, if tls_checkpeer is enabled in sudo_logsrvd.conf(5), a signed certificate on the client as well.

The certificates can either be signed by a well-known Certificate Authority (CA), or a private CA can be used. Instructions for creating a private CA are included below in the EXAMPLES section.

### Debugging sudo_logsrvd
sudo_logsrvd supports a flexible debugging framework that is configured via Debug lines in the sudo.conf(5) file.

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

## FILES
/etc/sudo.conf

Sudo front-end configuration

/etc/sudo_logsrvd.conf

Sudo log server configuration file

/var/log/sudo_logsrvd/incoming

Directory where new journals are stored when the store_first relay setting is enabled.

/var/log/sudo_logsrvd/outgoing

Directory where completed journals are stored when the store_first relay setting is enabled.

/var/log/sudo-io

Default I/O log file location

/var/run/sudo/sudo_logsrvd.pid

Process ID file for sudo_logsrvd

## EXAMPLES

### Creating self-signed certificates
Unless you are using certificates signed by a well-known Certificate Authority (or a local enterprise CA), you will need to create your own CA that can sign the certificates used by sudo_logsrvd, sudo_sendlog, and the sudoers plugin. The following steps use the openssl(1) command to create keys and certificates.

### Initial setup
First, we need to create a directory structure to store the files for the CA. We'll create a new directory hierarchy in /etc/ssl/sudo for this purpose.

```
# mkdir /etc/ssl/sudo
# cd /etc/ssl/sudo
# mkdir certs csr newcerts private
# chmod 700 private
# touch index.txt
# echo 1000 > serial
```

The serial and index.txt files are used to keep track of signed certificates.

Next, we need to make a copy of the openssl.conf file and customize it for our new CA. The path to openssl.cnf is system-dependent but /etc/ssl/openssl.cnf is the most common location. You will need to adjust the example below if it has a different location on your system.

```
# cp /etc/ssl/openssl.cnf .
```

Now edit the openssl.cnf file in the current directory and make sure it contains “ca”, “CA_default”, “v3_ca”, and “usr_cert” sections. Those sections should include at least the following settings:

```
[ ca ]
default_ca              = CA_default

[ CA_default ]
dir                     = /etc/ssl/sudo
certs                   = $dir/certs
database                = $dir/index.txt
certificate             = $dir/cacert.pem
serial                  = $dir/serial

[ v3_ca ]
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid:always,issuer
basicConstraints        = critical,CA:true
keyUsage                = cRLSign, keyCertSign

[ usr_cert ]
basicConstraints        = CA:FALSE
keyUsage                = nonRepudiation, digitalSignature, \
                          keyEncipherment
subjectKeyIdentifier    = hash
authorityKeyIdentifier  = keyid,issuer
```

If your openssl.conf file already has a “CA_default” section, you may only need to modify the “dir” setting and enable the “keyUsage” settings if they are commented out.

### Creating the CA key and certificate
In order to create and sign our own certificates, we need to create a private key and a certificate for the root of the CA. First, create the private key and protect it with a pass phrase:

```
# openssl genrsa -aes256 -out private/cakey.pem 4096
# chmod 400 private/cakey.pem
```

Next, generate the root certificate, using appropriate values for the site-specific fields:

```
# openssl req -config openssl.cnf -key private/cakey.pem \
    -new -x509 -days 7300 -sha256 -extensions v3_ca \
    -out cacert.pem

Enter pass phrase for private/cakey.pem:
You are about to be asked to enter information that will be
incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name
or a DN.
There are quite a few fields but you can leave some blank.
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Colorado
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgets Pty Ltd]:sudo
Organizational Unit Name (eg, section) []:sudo Certificate Authority
Common Name (e.g., server FQDN or YOUR name) []:sudo Root CA
Email Address []:

# chmod 444 cacert.pem
```

Finally, verify the root certificate:

```
# openssl x509 -noout -text -in cacert.pem
```

### Creating and signing certificates
The server and client certificates will be signed by the previously created root CA. Usually, the root CA is not used to sign server/client certificates directly. Instead, intermediate certificates are created and signed with the root CA and the intermediate certs are used to sign CSRs (Certificate Signing Request). In this example we'll skip this part for simplicity's sake and sign the CSRs with the root CA.

First, generate the private key without a pass phrase.

```
# openssl genrsa -out private/logsrvd_key.pem 2048
# chmod 400 private/logsrvd_key.pem
```

Next, create a certificate signing request (CSR) for the server's certificate. The organization name must match the name given in the root certificate. The common name should be either the server's IP address or a fully qualified domain name.

```
# openssl req -config openssl.cnf -key private/logsrvd_key.pem -new \
    -sha256 -out csr/logsrvd_csr.pem

Enter pass phrase for private/logsrvd_key.pem:
You are about to be asked to enter information that will be
incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name
or a DN.
There are quite a few fields but you can leave some blank.
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Colorado
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgets Pty Ltd]:sudo
Organizational Unit Name (eg, section) []:sudo log server
Common Name (e.g., server FQDN or YOUR name) []:logserver.example.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
```

Now sign the CSR that was just created:

```
# openssl ca -config openssl.cnf -days 375 -notext -md sha256 \
    -in csr/logsrvd_csr.pem -out certs/logsrvd_cert.pem

Using configuration from openssl.cnf
Enter pass phrase for ./private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 4096 (0x1000)
        Validity
            Not Before: Nov 11 14:05:05 2019 GMT
            Not After : Nov 20 14:05:05 2020 GMT
        Subject:
            countryName               = US
            stateOrProvinceName       = Colorado
            organizationName          = sudo
            organizationalUnitName    = sudo log server
            commonName                = logserve.example.com
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            X509v3 Key Usage:
                Digital Signature, Non Repudiation, Key Encipherment
            X509v3 Subject Key Identifier:
                4C:50:F9:D0:BE:1A:4C:B2:AC:90:76:56:C7:9E:16:AE:E6:9E:E5:B5
            X509v3 Authority Key Identifier:
                keyid:D7:91:24:16:B1:03:06:65:1A:7A:6E:CF:51:E9:5C:CB:7A:95:3E:0C

Certificate is to be certified until Nov 20 14:05:05 2020 GMT (375 days)
Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
```

Finally, verify the new certificate:

```
# openssl verify -CAfile cacert.pem certs/logsrvd_cert.pem
certs/logsrvd_cert.pem: OK
```

The /etc/ssl/sudo/certs directory now contains a signed and verified certificate for use with sudo_logsrvd.

To generate a client certificate, repeat the process above using a different file name.

### Configuring sudo_logsrvd to use TLS
To use TLS for client/server communication, both sudo_logsrvd and the sudoers plugin need to be configured to use TLS. Configuring sudo_logsrvd for TLS requires the following settings, assuming the same path names used earlier:

```
# Listen on port 30344 for TLS connections to any address.
listen_address = *:30344(tls)

# Path to the certificate authority bundle file in PEM format.
tls_cacert = /etc/ssl/sudo/cacert.pem

# Path to the server's certificate file in PEM format.
tls_cert = /etc/ssl/sudo/certs/logsrvd_cert.pem

# Path to the server's private key file in PEM format.
tls_key = /etc/ssl/sudo/private/logsrvd_key.pem
```

The root CA cert (cacert.pem) must be installed on the system running sudo_logsrvd. If peer authentication is enabled on the client, a copy of cacert.pem must be present on the client system too.

## SEE ALSO
sudo.conf(5), sudo_logsrv.proto(5), sudo_logsrvd.conf(5), sudoers(5), sudo(8), sudo_sendlog(8), sudoreplay(8)

## AUTHORS
Many people have worked on sudo over the years; this version consists of code written primarily by:

Todd C. Miller

See the CONTRIBUTORS.md file in the sudo distribution (https://www.sudo.ws/about/contributors/) for an exhaustive list of people who have contributed to sudo.

## BUGS
If you believe you have found a bug in sudo_logsrvd, you can either file a bug report in the sudo bug database, https://bugzilla.sudo.ws/, or open an issue at https://github.com/sudo-project/sudo/issues. If you would prefer to use email, messages may be sent to the sudo-workers mailing list, https://www.sudo.ws/mailman/listinfo/sudo-workers (public) or <sudo@sudo.ws> (private).

Please do not report security vulnerabilities through public GitHub issues, Bugzilla or mailing lists. Instead, report them via email to <Todd.Miller@sudo.ws>. You may encrypt your message with PGP if you would like, using the key found at https://www.sudo.ws/dist/PGPKEYS.

## SUPPORT
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.

## DISCLAIMER
sudo_logsrvd 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.md file distributed with sudo or https://www.sudo.ws/about/license/ for complete details.


title: sudo_sendlog(8)

summary: send sudo I/O log to log server

text:
# sudo_sendlog(8)

## NAME
sudo_sendlog — send sudo I/O log to log server

## SYNOPSIS
sudo_sendlog

[-AnV] [-b ca_bundle] [-c cert_file] [-h host] [-i iolog-id] [-k key_file] [-p port] [-r restart-point] [-R reject-reason] [-s stop-point] [-t number] path

## DESCRIPTION
sudo_sendlog can be used to send the existing sudoers I/O log path to a remote log server such as sudo_logsrvd(8) for central storage.

The options are as follows:

-A, --accept-only

Only send the accept event, not the I/O associated with the log. This can be used to test the logging of accept events without any associated I/O.

-b, --ca-bundle

The path to a certificate authority bundle file, in PEM format, to use instead of the system's default certificate authority database when authenticating the log server. The default is to use the system's default certificate authority database.

-c, --cert

The path to the client's certificate file in PEM format. This setting is required when the connection to the remote log server is secured with TLS.

--help

Display a short help message to the standard output and exit.

-h, --host

Connect to the specified host instead of localhost.

-i, --iolog-id

Use the specified iolog-id when restarting a log transfer. The iolog-id is reported by the server when it creates the remote I/O log. This option may only be used in conjunction with the -r option.

-k, --key

The path to the client's private key file in PEM format. This setting is required when the connection to the remote log server is secured with TLS.

-n, --no-verify

If specified, the server's certificate will not be verified during the TLS handshake. By default, sudo_sendlog verifies that the server's certificate is valid and that it contains either the server's host name or its IP address. This setting is only supported when the connection to the remote log server is secured with TLS.

-p, --port

Use the specified network port when connecting to the log server instead of the default, port 30344.

-r, --restart

Restart an interrupted connection to the log server. The specified restart-point is used to tell the server the point in time at which to continue the log. The restart-point is specified in the form “seconds,nanoseconds” and is usually the last commit point received from the server. The -i option must also be specified when restarting a transfer.

-R, --reject

Send a reject event for the command using the specified reject-reason, even though it was actually accepted locally. This can be used to test the logging of reject events; no I/O will be sent.

-s, --stop-after

Stop sending log records and close the connection when stop-point is reached. This can be used for testing purposes to send a partial I/O log to the server. Partial logs can be restarted using the -r option. The stop-point is an elapsed time specified in the form “seconds,nanoseconds”.

-t, --test

Open number simultaneous connections to the log server and send the specified I/O log file on each one. This option is useful for performance testing.

-V, --version

Print the sudo_sendlog version and exit.

### Debugging sendlog
sudo_sendlog supports a flexible debugging framework that is configured via Debug lines in the sudo.conf(5) file.

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

## FILES
/etc/sudo.conf

Sudo front-end configuration

## SEE ALSO
sudo.conf(5), sudo_logsrv.proto(5), sudo(8), sudo_logsrvd(8)

## AUTHORS
Many people have worked on sudo over the years; this version consists of code written primarily by:

Todd C. Miller

See the CONTRIBUTORS.md file in the sudo distribution (https://www.sudo.ws/about/contributors/) for an exhaustive list of people who have contributed to sudo.

## BUGS
If you believe you have found a bug in sudo_sendlog, you can either file a bug report in the sudo bug database, https://bugzilla.sudo.ws/, or open an issue at https://github.com/sudo-project/sudo/issues. If you would prefer to use email, messages may be sent to the sudo-workers mailing list, https://www.sudo.ws/mailman/listinfo/sudo-workers (public) or <sudo@sudo.ws> (private).

Please do not report security vulnerabilities through public GitHub issues, Bugzilla or mailing lists. Instead, report them via email to <Todd.Miller@sudo.ws>. You may encrypt your message with PGP if you would like, using the key found at https://www.sudo.ws/dist/PGPKEYS.

## SUPPORT
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.

## DISCLAIMER
sudo_sendlog 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.md file distributed with sudo or https://www.sudo.ws/about/license/ for complete details.


package: suspend-utils

title: s2disk(8)

summary: program to suspend to disk (hibernate)

text:
# s2disk(8)

## NAME
s2disk - program to suspend to disk (hibernate)

## SYNOPSIS
s2disk [-h, --help] [-V, --version] [-f, --config config_file] [-r, --resume_device device] [-o, --resume_offset offset] [-s, --image_size size] [-P, --parameter parameter]

## DESCRIPTION
This manual page documents briefly the s2disk, s2both and resume commands.

s2disk is a program that will save the state of the whole system to disk and power off your system. After restarting your system it will be put back in the exact system state you left it (this is sometimes called hibernation).

s2both will do precisly the same as s2disk except that it will not power off the system, but will suspend it to ram (put the system in S3 mode). This has the advantage that resume will be faster, with the disadvantage that you still use batteries. If they batteries do deplete, you still have the system state saved to disk and can resume without data loss. The s2both command also inherits all command line arguments from s2ram.

You will need to set up an initramfs which calls the resume program for this to work. If you use a package distributed with your Linux distribution, the kernel package which was made with the --initrd option and you use mkinitramfs-tools, this package should include the necessary parts on your initramfs.

The suspend-utils system supports encrypting the image written to disk and features a splash system, see suspend.conf(8) for more information.

## OPTIONS
-f, --config [file]

Specify alternate configuration file.

-h, --help

Display help.

-r, --resume_device [device]

Device that contains swap area.

-o, --resume_offset [offset]

Offset of swap file in resume device.

-s, --image_size [size]

Desired size of the image.

-P, --parameter [key=value]

Override any config file parameter (see suspend.conf(8)).

For the meaning and use of the resume_size, resume_offset and image_size options see suspend.conf(8).

## SEE ALSO
suspend.conf(8), suspend-keygen(8), s2ram(8)

For more information see the README file.

## AUTHOR
This manual page was written by Tim Dijkstra <tim@famdijkstra>.org for the Debian(TM) system (but may be used by others). Was updated by Rodolfo García <kix@kix.es>. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation.

## COPYRIGHT
Copyright © 2006 Tim Dijkstra Copyright © 2012 Rodolfo García (kix)


title: s2ram(8)

summary: program to suspend to ram (suspend)

text:
# s2ram(8)

## NAME
s2ram - program to suspend to ram (suspend)

## DESCRIPTION
This manual page documents briefly the s2ram command.

s2ram is a program that will suspend your system to ram (put it in S3 mode). Which means that the system is in a lower power mode. It asked to do so it will wake up farely quickly. However, if the system will run out of energy entirely you will lose data. That is why it is recommended to use s2both(8) s2ram is only provided to find out any work around needed to make suspend to both work. See README.s2ram-whitelist and README.Debian for more information.

## OPTIONS
-V, --version

Version information.

-a, --acpi_sleep nr

set the acpi_sleep parameter before suspend. 1=s3_bios, 2=s3_mode, 3=both. Only for Intel platform (x86/amd64).

-f, --force

force suspending, even on unknown machines. the following options are only available with --force.

-h, --help

Short help text.

-i, --identify

prints a string that identifies the machine.

-k, --kmstest

test if the kernel supports KMS (Kernel Mode Set). Returns 0 if KMS is supported.

-m, --vbe_mode

get VBE mode before suspend and set it after resume. Only for Intel platform (x86/amd64).

-n, --test

test if the machine is in the database. Returns 0 if known and supported.

-p, --vbe_post

VBE POST the graphics card after resume. Only for Intel platform (x86/amd64).

-r, --radeontool

turn off the backlight on radeons before suspending. Only for Intel platform (x86/amd64).

-s, --vbe_save

save VBE state before suspending and restore after resume. Only for Intel platform (x86/amd64).

-v, --pci_save

Save the PCI config space of the VGA card before suspend and restore it after resume. Only for Intel platform (x86/amd64).

--nofbsuspend

do not suspend the framebuffer (for debugging purposes). Only for Intel platform (x86/amd64).

## SEE ALSO
s2both (8).

For more information see the README.s2ram-whitelist.

## AUTHOR
This manual page was written by Tim Dijkstra <tim@famdijkstra>.org for the Debian(TM) system (but may be used by others). Was updated by Rodolfo García <kix@kix.es>. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation.

## COPYRIGHT
Copyright © 2006 Tim Dijkstra Copyright © 2012 Rodolfo García (kix)


suspend-keygen

title: suspend-keygen(8)

text:
# suspend-keygen(8)

## NAME
suspend-keygen - program to generate a RSA key to be used by s2disk

## DESCRIPTION
This manual page documents briefly the suspend-keygen command.

suspend-keygen is a program that will generate a RSA key which can be used by the s2disk to encrypt the image written to disk. The program does not take any options, but will ask to give the size of the key in bits and to supply a passphrase. You will have to enter this passphrase on resume to decrypt the image.

To start using encryption, you will have to point the "RSA key file" option in suspend.conf(8) to the file suspend-keygen generated.

## SEE ALSO
s2disk(8), suspend.conf(8).

For more information see the README file.

## AUTHOR
This manual page was written by Tim Dijkstra <tim@famdijkstra>.org for the Debian(TM) system (but may be used by others). Was updated by Rodolfo García <kix@kix.es>. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation.

## COPYRIGHT
Copyright © 2006 Tim Dijkstra Copyright © 2012 Rodolfo García (kix)


swap-offset

title: swap-offset(8)

text:
# swap-offset(8)

## NAME
swap-offset - program to calculate the offset of a swap file in a partition

## DESCRIPTION
This manual page documents briefly the swap-offset.

The programs s2disk and s2both can be used to save the state of the whole system to a swap partition or file and power off or suspend your system. After restarting your system it will be put back in the exact system state you left it (this is sometimes called hibernation).

In the case of using a swap file you will have to specify the location of the swap file's header as the offset from the beginning of the partition that contains the swap file. The swap-offset utility can be used to determine this value.

## SEE ALSO
suspend.conf(8), s2disk(8)

For more information see the README file.

## AUTHOR
This manual page was written by Tim Dijkstra <tim@famdijkstra>.org for the Debian(TM) system (but may be used by others). Was updated by Rodolfo García <kix@kix.es>. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation.

## COPYRIGHT
Copyright © 2006 Tim Dijkstra Copyright © 2012 Rodolfo García (kix)


package: svgalib-utils

title: mode3(8)

summary: set a vesa mode.

text:
# mode3(8)

## NAME
mode3 - set a vesa mode.

## SYNOPSIS
mode3 [modenum]

## DESCRIPTION
The video card is set to vesa mode modenum (or 3 by default) using the (real mode) vesa bios calls.

## BUGS
Using this program is unsafe, and might (depending on the bios) result in a video card in a state that requires a hard reset to restore to normal, or even a hung computer.


title: vga_reset(8)

summary: reset video graphic board

text:
# vga_reset(8)

## NAME
vga_reset - reset video graphic board

## SYNOPSIS
vga_reset

## DESCRIPTION
Call real mode c000:0003, which should be the video card's initialization routine. Should work in some cases when mode3 fails to restore text mode.

## BUGS
Using this program is unsafe, and might (depending on the bios) result in a video card in a state that requires a hard reset to restore to normal, or even a hung computer.

## SEE ALSO
mode3(8).

## AUTHOR
This manual page was written by Guillem Jover <guillem@debian.org>.


swapd

package: swapd

title: swapd(8)

summary: swap file daemon

text:
# swapd(8)

## NAME
swapd - swap file daemon

## SYNOPSIS
swapd [ -Vh ] [-c config] [-o cmd] [-m min] [-M max] [-s swapsize] [-d dir] [-u maxunusedswaps]

## OPTIONS
swapd is a background daemon that watches free memory and manages swap files. If free memory drops too low, additional swap files are created. Additionally, if there is too much free memory, swap files are deactivated and disk space may be reclaimed.

-V

Print version (1.0.5) and exit.

-h

Print minimalistic usage information.

-c config

Process an additional configuration file.

-o cmd

Process cmd as if it were a line in a configuration file.

-m min

Specify the lower boundary of free memory, below this amount of free memory additional swap files are created until atleast thismuch memory is free. This is the same as the minfree command in a configuration file.

-M max

Specify the upper boundary of free memory, above this amount of free memory swap files are deactivated and may be deleted to reclaim disk space. A value of zero (0) is the default and recommended value. This is the same as the maxfree command in a configuration file.

-s swapsize

Specify the size of each swap file. This is the same as the swapsize command in a configuration file.

-d dir

Specify the directory where swap files will be created. This is the same as the swapdir command in a configuration file.

-u maxunusedswaps

Specify the number of unused swaps that can exist before swap files start being deleted. This is the same as the maxunusedswaps command in a configuration file.

## DESCRIPTION
swapd is responsible for creating and managing only its swap files, swap files not created by swapd are not managed, but the memory they add to the `free' pool is still considered when deciding whether or not to create additional swap files.

## FILES
/etc/swapd.conf

## SEE ALSO
swapd.conf(5)

## AUTHOR
Roy Keene <swapd@rkeene.org>