Debian Codegraph @

docs/man/sudo.8.man

raw
1 .\" Automatically generated by Pandoc 3.6.3
2 .\"
3 .TH "SUDO" "8" "" "sudo\-rs 0.2.14" "sudo\-rs"
4 .SH NAME
5 \f[CR]sudo\f[R], \f[CR]sudoedit\f[R] \- execute a command as another
6 user
7 .SH SYNOPSIS
8 \f[CR]sudo\f[R] \f[CR]\-h\f[R] | \f[CR]\-K\f[R] | \f[CR]\-k\f[R] |
9 \f[CR]\-V\f[R]
10 .PD 0
11 .P
12 .PD
13 \f[CR]sudo\f[R] [\f[CR]\-u\f[R] \f[I]user\f[R]] [\f[CR]\-g\f[R]
14 \f[I]group\f[R]] [\f[CR]\-D\f[R] \f[I]directory\f[R]]
15 [\f[CR]\-BbknS\f[R]] [\f[CR]\-i\f[R] | \f[CR]\-s\f[R]]
16 [\f[CR]VAR=value\f[R]] [<\f[I]command\f[R]>]
17 .PD 0
18 .P
19 .PD
20 \f[CR]sudo\f[R] \f[CR]\-v\f[R] [\f[CR]\-BknS\f[R]] [\f[CR]\-u\f[R]
21 \f[I]user\f[R]] [\f[CR]\-g\f[R] \f[I]group\f[R]]
22 .PD 0
23 .P
24 .PD
25 \f[CR]sudo\f[R] \f[CR]\-l\f[R] [\f[CR]\-BknS\f[R]] [\f[CR]\-U\f[R]
26 \f[I]user\f[R]] [\f[CR]\-u\f[R] \f[I]user\f[R]] [\f[CR]\-g\f[R]
27 \f[I]group\f[R]] [command [arg \&...]]
28 .PD 0
29 .P
30 .PD
31 \f[CR]sudo\f[R] \f[CR]\-e\f[R] [\f[CR]\-BknS\f[R]] [\f[CR]\-u\f[R]
32 \f[I]user\f[R]] [\f[CR]\-g\f[R] \f[I]group\f[R]] file \&...
33 .PD 0
34 .P
35 .PD
36 \f[CR]sudoedit\f[R] [\f[CR]\-BknS\f[R]] [\f[CR]\-u\f[R] \f[I]user\f[R]]
37 [\f[CR]\-g\f[R] \f[I]group\f[R]] file \&...
38 .SH DESCRIPTION
39 \f[CR]sudo\f[R] allows a user that is permitted to do so to execute a
40 \f[I]command\f[R] as another user (for example \f[I]root\f[R]).
41 Permissions are specified by a security policy specified in
42 \f[CR]/etc/sudoers\f[R] (see sudoers(5)).
43 .PP
44 Sudo\-rs is a safety oriented and memory safe re\-implementation of the
45 original sudo implementation by Todd Miller.
46 .PP
47 When a command is run, a session record is stored for that specific
48 session allowing users to run additional commands without having to
49 re\-authenticate.
50 The timeout for session records can be specified in the policy.
51 .PP
52 Some care is taken to pass signals received by sudo\-rs to the child
53 process, even if that process runs in its own pseudo terminal.
54 .PP
55 On systems where sudo is the primary method of gaining superuser
56 privileges, it is imperative to avoid syntax errors in the
57 \f[CR]/etc/sudoers\f[R] file.
58 Changes to this file should be made using the visudo(8) utility which
59 will ensure that no syntax errors are introduced.
60 .SH OPTIONS
61 .TP
62 \f[CR]\-A\f[R], \f[CR]\-\-askpass\f[R]
63 Normally, if sudo requires a password, it will read it from the
64 user\[cq]s terminal.
65 If the \-A (askpass) option is specified, a (possibly graphical) helper
66 program is executed to read the user\[cq]s password and output the
67 password to the standard output.
68 If the SUDO_ASKPASS environment variable is set, it specifies the path
69 to the helper program.
70 If no askpass program is available, sudo will exit with an error.
71 .TP
72 \f[CR]\-B\f[R], \f[CR]\-\-bell\f[R]
73 Ring the bell as part of the password prompt when a terminal is present.
74 .TP
75 \f[CR]\-b\f[R], \f[CR]\-\-background\f[R]
76 Run the given \f[I]command\f[R] in the background.
77 It is not possible to use shell job control to manipulate background
78 processes started by sudo\-rs.
79 Most interactive \f[I]command\f[R]s will fail to work properly in
80 background mode.
81 .TP
82 \f[CR]\-D\f[R] \f[I]directory\f[R], \f[CR]\-\-chdir\f[R]=\f[I]directory\f[R]
83 Run the \f[I]command\f[R] in the specified \f[I]directory\f[R] instead
84 of the current working directory.
85 The security policy may return an error if the user does not have the
86 permission to specify the working directory.
87 .TP
88 \f[CR]\-g\f[R] \f[I]group\f[R], \f[CR]\-\-group\f[R]=\f[I]group\f[R]
89 Use this \f[I]group\f[R] as the primary group instead of using the
90 primary group specified in the password database for the target user.
91 .TP
92 \f[CR]\-h\f[R], \f[CR]\-\-help\f[R]
93 Show a help message.
94 .TP
95 \f[CR]\-i\f[R], \f[CR]\-\-login\f[R]
96 Run the shell specified by the target user\[cq]s password database entry
97 as a login shell.
98 This means that login\-specific resource files such as
99 \f[I].profile\f[R], \f[I].bash_profile\f[R] or \f[I].login\f[R] will be
100 read by the shell.
101 If a \f[I]command\f[R] is specified, it is passed to the shell using the
102 \f[CR]\-c\f[R] option.
103 .TP
104 \f[CR]\-K\f[R], \f[CR]\-\-remove\-timestamp\f[R]
105 Removes every cached session record for the user, regardless of where
106 the command is executed.
107 The next time sudo\-rs is run, authentication will take place if the
108 policy requires it.
109 No password is required to run this command.
110 .TP
111 \f[CR]\-k\f[R], \f[CR]\-\-reset\-timestamp\f[R]
112 When used without a command, invalidates the user\[cq]s session record
113 for the current session.
114 The next time sudo\-rs is run, authentication will take place if the
115 policy requires it.
116 .RS
117 .PP
118 When used in conjunction with a \f[I]command\f[R] or an option that may
119 require a password, this option will cause sudo\-rs to ignore the
120 user\[cq]s session record.
121 As a result, authentication will take place if the policy requires it.
122 When used in conjunction with a \f[I]command\f[R] no invalidation of
123 existing session records will take place.
124 .RE
125 .TP
126 \f[CR]\-n\f[R], \f[CR]\-\-non\-interactive\f[R]
127 Avoid prompting the user for input of any kind.
128 If any input is required for the \f[I]command\f[R] to run, sudo\-rs will
129 display an error message and exit.
130 .TP
131 \f[CR]\-p\f[R], \f[CR]\-\-prompt\f[R]=\f[I]prompt\f[R]
132 Use a custom authentication prompt with optional escape sequences.
133 The following percent (`%') escape sequences are supported:
134 .RS
135 .IP
136 .EX
137 %H expanded to the local host name
138
139 %h expanded to the local host name without the domain name
140
141 %p expanded to the name of the user whose password is being requested
142 (this respects the rootpw, targetpw flags)
143
144 %U expanded to the login name of the user the command will be run as
145 (defaults to root unless the \-u option is also specified)
146
147 %u expanded to the invoking user\[aq]s login name
148
149 %% two consecutive \[oq]%\[cq] characters are collapsed into a single \[oq]%\[cq] character
150 .EE
151 .PP
152 The custom prompt will override the default prompt or the one specified
153 by the SUDO_PROMPT environment variable.
154 No \f[I]prompt\f[R] will suppress the prompt provided by PAM, unless the
155 requested \f[I]prompt\f[R] is empty (\f[CR]\[dq]\[dq]\f[R])
156 .RE
157 .TP
158 \f[CR]\-S\f[R], \f[CR]\-\-stdin\f[R]
159 Read from standard input instead of using the terminal device.
160 .TP
161 \f[CR]\-s\f[R], \f[CR]\-\-shell\f[R]
162 Run the shell specified by the \f[CR]SHELL\f[R] environment variable.
163 If no shell was specified, the shell from the user\[cq]s password
164 database entry will be used instead.
165 If a \f[I]command\f[R] is specified, it is passed to the shell using the
166 \f[CR]\-c\f[R] option.
167 .TP
168 \f[CR]\-\-preserve\-env=list\f[R]
169 Indicates to the security policy that the user wishes to add the
170 comma\-separated list of environment variables to those preserved from
171 the user\[cq]s environment.
172 The security policy may return an error if the user does not have
173 permission to preserve the environment.
174 This option may be specified multiple times.
175 .TP
176 \f[CR]\-e\f[R], \f[CR]\-\-edit\f[R], \f[CR]sudoedit\f[R]
177 Edit one or more files instead of running a command.
178 In lieu of a path name, the string \[lq]sudoedit\[rq] is used when
179 consulting the security policy.
180 If the user is authorized by the policy, the following steps are taken:
181 .RS
182 .IP "1." 3
183 Temporary copies are made of the files to be edited with the owner set
184 to the invoking user.
185 .IP "2." 3
186 The editor specified by the policy is run to edit the temporary files.
187 The sudoers policy uses the SUDO_EDITOR, VISUAL and EDITOR environment
188 variables (in that order).
189 If none of SUDO_EDITOR, VISUAL or EDITOR are set, the first program
190 listed in the editor sudoers(5) option is used.
191 .IP "3." 3
192 If they have been modified, the content of the temporary files is copied
193 back to the originals and the temporary versions are removed.
194 .PP
195 To help prevent the editing of unauthorized files, the following
196 restrictions are enforced (unless the user is root):
197 .IP \[bu] 2
198 Symbolic links may not be edited.
199 .IP \[bu] 2
200 If any component of the path leading to the file is writable by the
201 invoking user, the file may not be edited.
202 .IP \[bu] 2
203 Users are never allowed to edit device special files.
204 .PP
205 If the specified file does not exist, it will be created.
206 Unlike most commands run by sudo, the editor is run with the invoking
207 user\[cq]s environment unmodified.
208 If the temporary file becomes empty after editing, the user will be
209 prompted before it is installed.
210 .RE
211 .TP
212 \f[CR]\-u\f[R] \f[I]user\f[R], \f[CR]\-\-user\f[R]=\f[I]user\f[R]
213 Run the \f[I]command\f[R] as another user than the default
214 (\f[B]root\f[R]).
215 .TP
216 \f[CR]\-V\f[R], \f[CR]\-\-version\f[R]
217 Display the current version of sudo\-rs.
218 .TP
219 \f[CR]\-v\f[R], \f[CR]\-\-validate\f[R]
220 Update the session record for the current session, authenticating the
221 user if necessary.
222 .TP
223 \f[CR]\-l\f[R], \f[CR]\-\-list\f[R]
224 List user\[cq]s privileges or check a specific command; use twice for
225 longer format
226 .TP
227 \f[CR]\-U\f[R], \f[CR]\-\-other\-user\f[R]=\f[I]user\f[R]
228 Used in list mode, display privileges for another user
229 .TP
230 \f[CR]\-\-\f[R]
231 Indicates the end of the sudo\-rs options and start of the
232 \f[I]command\f[R].
233 .PP
234 Environment variables to be set for the command may be passed on the
235 command line in the form of VAR=value.
236 Variables passed on the command line are subject to restrictions imposed
237 by the security policy.
238 Variables passed on the command line are subject to the same
239 restrictions as normal environment variables with one important
240 exception: If the command to be run has the SETENV tag set or the
241 command matched is ALL, the user may set variables that would otherwise
242 be forbidden.
243 See sudoers(5) for more information.
244 .SH SEE ALSO
245 su(1), sudoers(5), visudo(8)