1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH PPRIV 1 "Feb 24, 2008"
.SH NAME
ppriv \- inspect or modify process privilege sets and attributes
.SH SYNOPSIS
.LP
.nf
\fB/usr/bin/ppriv\fR \fB-e\fR [\fB-D\fR | \fB-N\fR] [\fB-M\fR] [\fB-s\fR \fIspec\fR] \fIcommand\fR [\fIarg\fR]...
.fi
.LP
.nf
\fB/usr/bin/ppriv\fR [\fB-v\fR] [\fB-S\fR] [\fB-D\fR | \fB-N\fR] [\fB-s\fR \fIspec\fR]
[\fIpid\fR | \fIcore\fR]...
.fi
.LP
.nf
\fB/usr/bin/ppriv\fR \fB-l\fR [\fB-v\fR] [\fIprivilege-specification\fR]...
.fi
.SH DESCRIPTION
.sp
.LP
The first invocation of the \fBppriv\fR command runs the \fIcommand\fR
specified with the privilege sets and flags modified according to the arguments
on the command line.
.sp
.LP
The second invocation examines or changes the privilege state of running
process and core files.
.sp
.LP
The third invocation lists the privileges defined and information about
specified privileges or privileges set specifications.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-D\fR\fR
.ad
.RS 11n
Turns on privilege debugging for the processes or command supplied.
.RE
.sp
.ne 2
.na
\fB\fB-e\fR\fR
.ad
.RS 11n
Interprets the remainder of the arguments as a command line and runs the
command line with specified privilege attributes and sets.
.RE
.sp
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.RS 11n
Lists all currently defined privileges on stdout.
.RE
.sp
.ne 2
.na
\fB\fB-M\fR\fR
.ad
.RS 11n
When a system is configured with Trusted Extensions, this option turns on the
\fBNET_MAC_AWARE\fR and \fBNET_MAC_AWARE_INHERIT\fR process attributes.
.sp
A process with these attributes and the \fBnet_mac_aware\fR privilege can
communicate with lower-level remote peers.
.RE
.sp
.ne 2
.na
\fB\fB-N\fR\fR
.ad
.RS 11n
Turns off privilege debugging for the processes or command supplied.
.RE
.sp
.ne 2
.na
\fB\fB-s\fR \fIspec\fR\fR
.ad
.RS 11n
Modifies a process's privilege sets according to \fIspec\fR, a specification
with the format \fB[AEILP][+-=]\fR\fIprivsetspec\fR, containing no spaces,
where:
.sp
.ne 2
.na
\fB\fBAEILP\fR\fR
.ad
.RS 15n
Indicates one or more letters indicating which privilege sets to change. These
are case insensitive, for example, either \fBa\fR or \fBA\fR indicates all
privilege sets.
.RE
.sp
.ne 2
.na
\fB\fB+-=\fR\fR
.ad
.RS 15n
Indicates a modifier to respectively add (\fB+\fR), remove (\fB-\fR), or assign
(\fB=\fR) the listed privileges to the specified set(s) in \fIprivsetspec\fR.
.RE
.sp
.ne 2
.na
\fB\fIprivsetspec\fR\fR
.ad
.RS 15n
Indicates a comma-separated privilege set specification
(\fBpriv1\fR,\fBpriv2\fR, and so on), as described in
\fBpriv_str_to_set\fR(3C).
.RE
Modifying the same set with multiple \fB-s\fR options is possible as long as
there is either precisely one assignment to an individual set or any number of
additions and removals. That is, assignment and addition or removal for one set
are mutually exclusive.
.RE
.sp
.ne 2
.na
\fB\fB-S\fR\fR
.ad
.RS 11n
Short. Reports the shortest possible output strings for sets. The default is
portable output. See \fBpriv_str_to_set\fR(3C).
.RE
.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 11n
Verbose. Reports privilege sets using privilege names.
.RE
.SH USAGE
.sp
.LP
The \fBppriv\fR utility examines processes and core files and prints or changes
their privilege sets.
.sp
.LP
\fBppriv\fR can run commands with privilege debugging on or off or with fewer
privileges than the invoking process.
.sp
.LP
When executing a sub process, the only sets that can be modified are \fBL\fR
and \fBI\fR. Privileges can only be removed from \fBL\fR and \fBI\fR as
\fBppriv\fR starts with \fBP=E=I\fR.
.sp
.LP
\fBppriv\fR can also be used to remove privileges from processes or to convey
privileges to other processes. In order to control a process, the effective set
of the \fBppriv\fR utility must be a super set of the controlled process's
\fBE\fR, \fBI\fR, and \fBP\fR. The utility's limit set must be a super set of
the target's limit set. If the target's process uids do not match, the
\fB{PRIV_PROC_OWNER}\fR privilege must be asserted in the utility's effective
set. If the controlled processes have any uid with the value \fB0\fR, more
restrictions might exist. See \fBprivileges\fR(5).
.SH EXAMPLES
.LP
\fBExample 1 \fRObtaining the Process Privileges of the Current Shell
.sp
.LP
The following example obtains the process privileges of the current shell:
.sp
.in +2
.nf
example$ \fBppriv $$\fR
387: -sh
flags = <none>
E: basic
I: basic
P: basic
L: all
.fi
.in -2
.sp
.LP
\fBExample 2 \fRRemoving a Privilege From Your Shell's Inheritable and
Effective Set
.sp
.LP
The following example removes a privilege from your shell's inheritable and
effective set.
.sp
.in +2
.nf
example$ \fBppriv -s EI-proc_session $$\fR
.fi
.in -2
.sp
.sp
.LP
The subprocess can still inspect the parent shell but it can no longer
influence the parent because the parent has more privileges in its Permitted
set than the \fBppriv\fR child process:
.sp
.in +2
.nf
example$ \fBtruss -p $$\fR
truss: permission denied: 387
example$ \fBppriv $$\fR
387: -sh
flags = <none>
E: basic,!proc_session
I: basic,!proc_session
P: basic
L: all
.fi
.in -2
.sp
.LP
\fBExample 3 \fRRunning a Process with Privilege Debugging
.sp
.LP
The following example runs a process with privilege debugging:
.sp
.in +2
.nf
example$ \fBppriv -e -D cat /etc/shadow\fR
cat[418]: missing privilege "file_dac_read" (euid = 21782),
needed at ufs_access+0x3c
cat: cannot open /etc/shadow
.fi
.in -2
.sp
.sp
.LP
The privilege debugging error messages are sent to the controlling terminal of
the current process. The \fBneeded at\fR address specification is an artifact
of the kernel implementation and it can be changed at any time after a software
update.
.sp
.LP
The system call number can be mapped to a system call using
\fB/etc/name_to_sysnum\fR.
.LP
\fBExample 4 \fRListing the Privileges Available in the Current Zone
.sp
.LP
The following example lists the privileges available in the current zone (see
\fBzones\fR(5)). When run in the global zone, all defined privileges are
listed.
.sp
.in +2
.nf
example$ \fBppriv -l zone\fR
... listing of all privileges elided ...
.fi
.in -2
.sp
.LP
\fBExample 5 \fRExamining a Privilege Aware Process
.sp
.LP
The following example examines a privilege aware process:
.sp
.in +2
.nf
example$ \fBppriv -S `pgrep rpcbind`\fR
928: /usr/sbin/rpcbind
flags = PRIV_AWARE
E: net_privaddr,proc_fork,sys_nfs
I: none
P: net_privaddr,proc_fork,sys_nfs
L: none
.fi
.in -2
.sp
.sp
.LP
See \fBsetpflags\fR(2) for explanations of the flags.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 12n
Successful operation.
.RE
.sp
.ne 2
.na
\fBnon-zero\fR
.ad
.RS 12n
An error has occurred.
.RE
.SH FILES
.sp
.ne 2
.na
\fB\fB/proc/*\fR\fR
.ad
.RS 23n
Process files
.RE
.sp
.ne 2
.na
\fB\fB/etc/name_to_sysnum\fR\fR
.ad
.RS 23n
system call name to number mapping
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability See below.
.TE
.sp
.LP
The invocation is Committed. The output is Uncommitted.
.SH SEE ALSO
.sp
.LP
\fBgcore\fR(1), \fBtruss\fR(1), \fBsetpflags\fR(2), \fBpriv_str_to_set\fR(3C),
\fBproc\fR(4), \fBattributes\fR(5), \fBprivileges\fR(5), \fBzones\fR(5)
|