|
| 1 | +% SUDO(8) sudo-rs 0.2.0 |
| 2 | +% |
| 3 | +% July 10, 2023 |
| 4 | + |
| 5 | +# NAME |
| 6 | + |
| 7 | +`sudo` - execute a command as another user |
| 8 | + |
| 9 | +# SYNOPSIS |
| 10 | + |
| 11 | +`sudo` [`-u` *user*] [`-g` *group*] [`-D` *directory*] [`-knS`] [`-i` | `-s`] [*command*] \ |
| 12 | +`sudo` `-h` | `-K` | `-k` | `-V` |
| 13 | + |
| 14 | +# DESCRIPTION |
| 15 | + |
| 16 | +`sudo` allows a user that is permitted to do so to execute a *command* as |
| 17 | +another user (for example *root*). Permissions are specified by a security |
| 18 | +policy specified in `/etc/sudoers` (see sudoers(5)). |
| 19 | + |
| 20 | +Sudo-rs is a safety oriented and memory safe re-implementation of the original |
| 21 | +sudo implementation by Todd Miller. |
| 22 | + |
| 23 | +When a command is run, a session record is stored for that specific session |
| 24 | +allowing users to run additional commands without having to re-authenticate. The |
| 25 | +timeout for session records can be specified in the policy. |
| 26 | + |
| 27 | +Some care is taken to pass signals received by sudo-rs to the child process, |
| 28 | +even if that process runs in its own pseudo terminal. |
| 29 | + |
| 30 | +# OPTIONS |
| 31 | + |
| 32 | +`-D` *directory*, `--chdir`=*directory* |
| 33 | +: Run the *command* in the specified *directory* instead of the current |
| 34 | + working directory. The security policy may return an error if the user does |
| 35 | + not have the permission to specify the working directory. |
| 36 | + |
| 37 | +`-g` *group*, `--group`=*group* |
| 38 | +: Use this *group* as the primary group instead of using the primary group |
| 39 | + specified in the password database for the target user. |
| 40 | + |
| 41 | +`-h`, `--help` |
| 42 | +: Show this help message. |
| 43 | + |
| 44 | +`-i`, `--login` |
| 45 | +: Run the shell specified by the target user's password database entry as a |
| 46 | + login shell. This means that login-specific resource files such as |
| 47 | + *.profile*, *.bash_profile* or *.login* will be read by the shell. If a |
| 48 | + *command* is specified, it is passed to the shell using the `-c` option. |
| 49 | + |
| 50 | +`-K`, `--remove-timestamp` |
| 51 | +: Removes every cached session record for the user, regardless of where the |
| 52 | + command is executed. The next time sudo-rs is run, authentication will take |
| 53 | + place if the policy requires it. No password is required to run this |
| 54 | + command. |
| 55 | + |
| 56 | +`-k`, `--reset-timestamp` |
| 57 | +: When used without a command, invalidates the user's session record for |
| 58 | + the current session. The next time sudo-rs is run, authentication will take |
| 59 | + place if the policy requires it. |
| 60 | + |
| 61 | + When used in conjuction with a *command* or an option that may require a |
| 62 | + password, this option will cause sudo-rs to ignore the user's session |
| 63 | + record. As a result, authentication will take place if the policy requires |
| 64 | + it. When used in conjuction with a *command* no invalidation of existing |
| 65 | + session records will take place. |
| 66 | + |
| 67 | +`-n`, `--non-interactive` |
| 68 | +: Avoid prompting the user for input of any kind. If any input is required for |
| 69 | + the *command* to run, sudo-rs will display an error message and exit. |
| 70 | + |
| 71 | +`-S`, `--stdin` |
| 72 | +: Read from standard input instead of using the terminal device. |
| 73 | + |
| 74 | +`-s`, `--shell` |
| 75 | +: Run the shell specified by the `SHELL` environment variable. If no shell |
| 76 | + was specified, the shell from the user's password database entry will be |
| 77 | + used instead. If a *command* is specified, it is passed to the shell using |
| 78 | + the `-c` option. |
| 79 | + |
| 80 | +`-u` *user*, `--user`=*user* |
| 81 | +: Run the *command* as another user than the default (**root**). |
| 82 | + |
| 83 | +`-V`, `--version` |
| 84 | +: Display the current version of sudo-rs. |
| 85 | + |
| 86 | +`-v`, `--validate` |
| 87 | +: Update the session record for the current session, authenticating the user |
| 88 | + if necessary. |
| 89 | + |
| 90 | +`--` |
| 91 | +: Indicates the end of the sudo-rs options and start of the *command*. |
| 92 | + |
| 93 | +# SEE ALSO |
| 94 | +su(1), sudoers(5), visudo(8) |
0 commit comments