1CAPABILITIES(7) Linux Programmer's Manual CAPABILITIES(7)
2
3
4
6 capabilities - overview of Linux capabilities
7
9 For the purpose of performing permission checks, traditional UNIX
10 implementations distinguish two categories of processes: privileged
11 processes (whose effective user ID is 0, referred to as superuser or
12 root), and unprivileged processes (whose effective UID is nonzero).
13 Privileged processes bypass all kernel permission checks, while unpriv‐
14 ileged processes are subject to full permission checking based on the
15 process's credentials (usually: effective UID, effective GID, and sup‐
16 plementary group list).
17
18 Starting with kernel 2.2, Linux divides the privileges traditionally
19 associated with superuser into distinct units, known as capabilities,
20 which can be independently enabled and disabled. Capabilities are a
21 per-thread attribute.
22
23 Capabilities list
24 The following list shows the capabilities implemented on Linux, and the
25 operations or behaviors that each capability permits:
26
27 CAP_AUDIT_CONTROL (since Linux 2.6.11)
28 Enable and disable kernel auditing; change auditing filter
29 rules; retrieve auditing status and filtering rules.
30
31 CAP_AUDIT_WRITE (since Linux 2.6.11)
32 Write records to kernel auditing log.
33
34 CAP_BLOCK_SUSPEND (since Linux 3.5)
35 Employ features that can block system suspend (epoll(7) EPOLL‐
36 WAKEUP, /proc/sys/wake_lock).
37
38 CAP_CHOWN
39 Make arbitrary changes to file UIDs and GIDs (see chown(2)).
40
41 CAP_DAC_OVERRIDE
42 Bypass file read, write, and execute permission checks. (DAC is
43 an abbreviation of "discretionary access control".)
44
45 CAP_DAC_READ_SEARCH
46 * Bypass file read permission checks and directory read and exe‐
47 cute permission checks;
48 * Invoke open_by_handle_at(2).
49
50
51 CAP_FOWNER
52 * Bypass permission checks on operations that normally require
53 the file system UID of the process to match the UID of the
54 file (e.g., chmod(2), utime(2)), excluding those operations
55 covered by CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH;
56 * set extended file attributes (see chattr(1)) on arbitrary
57 files;
58 * set Access Control Lists (ACLs) on arbitrary files;
59 * ignore directory sticky bit on file deletion;
60 * specify O_NOATIME for arbitrary files in open(2) and fcntl(2).
61
62 CAP_FSETID
63 Don't clear set-user-ID and set-group-ID permission bits when a
64 file is modified; set the set-group-ID bit for a file whose GID
65 does not match the file system or any of the supplementary GIDs
66 of the calling process.
67
68 CAP_IPC_LOCK
69 Lock memory (mlock(2), mlockall(2), mmap(2), shmctl(2)).
70
71 CAP_IPC_OWNER
72 Bypass permission checks for operations on System V IPC objects.
73
74 CAP_KILL
75 Bypass permission checks for sending signals (see kill(2)).
76 This includes use of the ioctl(2) KDSIGACCEPT operation.
77
78 CAP_LEASE (since Linux 2.4)
79 Establish leases on arbitrary files (see fcntl(2)).
80
81 CAP_LINUX_IMMUTABLE
82 Set the FS_APPEND_FL and FS_IMMUTABLE_FL i-node flags (see
83 chattr(1)).
84
85 CAP_MAC_ADMIN (since Linux 2.6.25)
86 Override Mandatory Access Control (MAC). Implemented for the
87 Smack Linux Security Module (LSM).
88
89 CAP_MAC_OVERRIDE (since Linux 2.6.25)
90 Allow MAC configuration or state changes. Implemented for the
91 Smack LSM.
92
93 CAP_MKNOD (since Linux 2.4)
94 Create special files using mknod(2).
95
96 CAP_NET_ADMIN
97 Perform various network-related operations:
98 * interface configuration;
99 * administration of IP firewall, masquerading, and accounting;
100 * modify routing tables;
101 * bind to any address for transparent proxying;
102 * set type-of-service (TOS)
103 * clear driver statistics;
104 * set promiscuous mode;
105 * enabling multicasting;
106 * use setsockopt(2) to set the following socket options:
107 SO_DEBUG, SO_MARK, SO_PRIORITY (for a priority outside the
108 range 0 to 6), SO_RCVBUFFORCE, and SO_SNDBUFFORCE.
109
110 CAP_NET_BIND_SERVICE
111 Bind a socket to Internet domain privileged ports (port numbers
112 less than 1024).
113
114 CAP_NET_BROADCAST
115 (Unused) Make socket broadcasts, and listen to multicasts.
116
117 CAP_NET_RAW
118 * use RAW and PACKET sockets;
119 * bind to any address for transparent proxying.
120
121 CAP_SETGID
122 Make arbitrary manipulations of process GIDs and supplementary
123 GID list; forge GID when passing socket credentials via UNIX
124 domain sockets.
125
126 CAP_SETFCAP (since Linux 2.6.24)
127 Set file capabilities.
128
129 CAP_SETPCAP
130 If file capabilities are not supported: grant or remove any
131 capability in the caller's permitted capability set to or from
132 any other process. (This property of CAP_SETPCAP is not avail‐
133 able when the kernel is configured to support file capabilities,
134 since CAP_SETPCAP has entirely different semantics for such ker‐
135 nels.)
136
137 If file capabilities are supported: add any capability from the
138 calling thread's bounding set to its inheritable set; drop capa‐
139 bilities from the bounding set (via prctl(2) PR_CAPBSET_DROP);
140 make changes to the securebits flags.
141
142 CAP_SETUID
143 Make arbitrary manipulations of process UIDs (setuid(2),
144 setreuid(2), setresuid(2), setfsuid(2)); make forged UID when
145 passing socket credentials via UNIX domain sockets.
146
147 CAP_SYS_ADMIN
148 * Perform a range of system administration operations including:
149 quotactl(2), mount(2), umount(2), swapon(2), swapoff(2),
150 sethostname(2), and setdomainname(2);
151 * perform privileged syslog(2) operations (since Linux 2.6.37,
152 CAP_SYSLOG should be used to permit such operations);
153 * perform VM86_REQUEST_IRQ vm86(2) command;
154 * perform IPC_SET and IPC_RMID operations on arbitrary System V
155 IPC objects;
156 * perform operations on trusted and security Extended Attributes
157 (see attr(5));
158 * use lookup_dcookie(2);
159 * use ioprio_set(2) to assign IOPRIO_CLASS_RT and (before Linux
160 2.6.25) IOPRIO_CLASS_IDLE I/O scheduling classes;
161 * forge UID when passing socket credentials;
162 * exceed /proc/sys/fs/file-max, the system-wide limit on the
163 number of open files, in system calls that open files (e.g.,
164 accept(2), execve(2), open(2), pipe(2));
165 * employ CLONE_* flags that create new namespaces with clone(2)
166 and unshare(2);
167 * call perf_event_open(2);
168 * access privileged perf event information;
169 * call setns(2);
170 * call fanotify_init(2);
171 * perform KEYCTL_CHOWN and KEYCTL_SETPERM keyctl(2) operations;
172 * perform madvise(2) MADV_HWPOISON operation;
173 * employ the TIOCSTI ioctl(2) to insert characters into the
174 input queue of a terminal other than the caller's controlling
175 terminal.
176 * employ the obsolete nfsservctl(2) system call;
177 * employ the obsolete bdflush(2) system call;
178 * perform various privileged block-device ioctl(2) operations;
179 * perform various privileged file-system ioctl(2) operations;
180 * perform administrative operations on many device drivers.
181
182 CAP_SYS_BOOT
183 Use reboot(2) and kexec_load(2).
184
185 CAP_SYS_CHROOT
186 Use chroot(2).
187
188 CAP_SYS_MODULE
189 Load and unload kernel modules (see init_module(2) and
190 delete_module(2)); in kernels before 2.6.25: drop capabilities
191 from the system-wide capability bounding set.
192
193 CAP_SYS_NICE
194 * Raise process nice value (nice(2), setpriority(2)) and change
195 the nice value for arbitrary processes;
196 * set real-time scheduling policies for calling process, and set
197 scheduling policies and priorities for arbitrary processes
198 (sched_setscheduler(2), sched_setparam(2));
199 * set CPU affinity for arbitrary processes (sched_setaffin‐
200 ity(2));
201 * set I/O scheduling class and priority for arbitrary processes
202 (ioprio_set(2));
203 * apply migrate_pages(2) to arbitrary processes and allow pro‐
204 cesses to be migrated to arbitrary nodes;
205 * apply move_pages(2) to arbitrary processes;
206 * use the MPOL_MF_MOVE_ALL flag with mbind(2) and move_pages(2).
207
208 CAP_SYS_PACCT
209 Use acct(2).
210
211 CAP_SYS_PTRACE
212 Trace arbitrary processes using ptrace(2); apply
213 get_robust_list(2) to arbitrary processes; inspect processes
214 using kcmp(2).
215
216 CAP_SYS_RAWIO
217 * Perform I/O port operations (iopl(2) and ioperm(2));
218 * access /proc/kcore;
219 * employ the FIBMAP ioctl(2) operation;
220 * open devices for accessing x86 model-specific registers (MSRs,
221 see msr(4))
222 * update /proc/sys/vm/mmap_min_addr;
223 * create memory mappings at addresses below the value specified
224 by /proc/sys/vm/mmap_min_addr;
225 * map files in /proc/bus/pci;
226 * open /dev/mem and /dev/kmem;
227 * perform various SCSI device commands;
228 * perform certain operations on hpsa(4) and cciss(4) devices;
229 * perform a range of device-specific operations on other
230 devices.
231
232 CAP_SYS_RESOURCE
233 * Use reserved space on ext2 file systems;
234 * make ioctl(2) calls controlling ext3 journaling;
235 * override disk quota limits;
236 * increase resource limits (see setrlimit(2));
237 * override RLIMIT_NPROC resource limit;
238 * override maximum number of consoles on console allocation;
239 * override maximum number of keymaps;
240 * allow more than 64hz interrupts from the real-time clock;
241 * raise msg_qbytes limit for a System V message queue above the
242 limit in /proc/sys/kernel/msgmnb (see msgop(2) and msgctl(2));
243 * override the /proc/sys/fs/pipe-size-max limit when setting the
244 capacity of a pipe using the F_SETPIPE_SZ fcntl(2) command.
245 * use F_SETPIPE_SZ to increase the capacity of a pipe above the
246 limit specified by /proc/sys/fs/pipe-max-size;
247 * override /proc/sys/fs/mqueue/queues_max limit when creating
248 POSIX message queues (see mq_overview(7));
249 * employ prctl(2) PR_SET_MM operation;
250 * set /proc/PID/oom_score_adj to a value lower than the value
251 last set by a process with CAP_SYS_RESOURCE.
252
253 CAP_SYS_TIME
254 Set system clock (settimeofday(2), stime(2), adjtimex(2)); set
255 real-time (hardware) clock.
256
257 CAP_SYS_TTY_CONFIG
258 Use vhangup(2); employ various privileged ioctl(2) operations on
259 virtual terminals.
260
261 CAP_SYSLOG (since Linux 2.6.37)
262
263 * Perform privileged syslog(2) operations. See syslog(2) for informa‐
264 tion on which operations require privilege.
265
266 * View kernel addresses exposed via /proc and other interfaces when
267 /proc/sys/kernel/kptr_restrict has the value 1. (See the discussion
268 of the kptr_restrict in proc(5).)
269
270 CAP_WAKE_ALARM (since Linux 3.0)
271 Trigger something that will wake up the system (set CLOCK_REAL‐
272 TIME_ALARM and CLOCK_BOOTTIME_ALARM timers).
273
274 Past and current implementation
275 A full implementation of capabilities requires that:
276
277 1. For all privileged operations, the kernel must check whether the
278 thread has the required capability in its effective set.
279
280 2. The kernel must provide system calls allowing a thread's capability
281 sets to be changed and retrieved.
282
283 3. The file system must support attaching capabilities to an executable
284 file, so that a process gains those capabilities when the file is
285 executed.
286
287 Before kernel 2.6.24, only the first two of these requirements are met;
288 since kernel 2.6.24, all three requirements are met.
289
290 Thread capability sets
291 Each thread has three capability sets containing zero or more of the
292 above capabilities:
293
294 Permitted:
295 This is a limiting superset for the effective capabilities that
296 the thread may assume. It is also a limiting superset for the
297 capabilities that may be added to the inheritable set by a
298 thread that does not have the CAP_SETPCAP capability in its
299 effective set.
300
301 If a thread drops a capability from its permitted set, it can
302 never reacquire that capability (unless it execve(2)s either a
303 set-user-ID-root program, or a program whose associated file
304 capabilities grant that capability).
305
306 Inheritable:
307 This is a set of capabilities preserved across an execve(2). It
308 provides a mechanism for a process to assign capabilities to the
309 permitted set of the new program during an execve(2).
310
311 Effective:
312 This is the set of capabilities used by the kernel to perform
313 permission checks for the thread.
314
315 A child created via fork(2) inherits copies of its parent's capability
316 sets. See below for a discussion of the treatment of capabilities dur‐
317 ing execve(2).
318
319 Using capset(2), a thread may manipulate its own capability sets (see
320 below).
321
322 Since Linux 3.2, the file /proc/sys/kernel/cap_last_cap exposes the
323 numerical value of the highest capability supported by the running ker‐
324 nel; this can be used to determine the highest bit that may be set in a
325 capability set.
326
327 File capabilities
328 Since kernel 2.6.24, the kernel supports associating capability sets
329 with an executable file using setcap(8). The file capability sets are
330 stored in an extended attribute (see setxattr(2)) named security.capa‐
331 bility. Writing to this extended attribute requires the CAP_SETFCAP
332 capability. The file capability sets, in conjunction with the capabil‐
333 ity sets of the thread, determine the capabilities of a thread after an
334 execve(2).
335
336 The three file capability sets are:
337
338 Permitted (formerly known as forced):
339 These capabilities are automatically permitted to the thread,
340 regardless of the thread's inheritable capabilities.
341
342 Inheritable (formerly known as allowed):
343 This set is ANDed with the thread's inheritable set to determine
344 which inheritable capabilities are enabled in the permitted set
345 of the thread after the execve(2).
346
347 Effective:
348 This is not a set, but rather just a single bit. If this bit is
349 set, then during an execve(2) all of the new permitted capabili‐
350 ties for the thread are also raised in the effective set. If
351 this bit is not set, then after an execve(2), none of the new
352 permitted capabilities is in the new effective set.
353
354 Enabling the file effective capability bit implies that any file
355 permitted or inheritable capability that causes a thread to
356 acquire the corresponding permitted capability during an
357 execve(2) (see the transformation rules described below) will
358 also acquire that capability in its effective set. Therefore,
359 when assigning capabilities to a file (setcap(8),
360 cap_set_file(3), cap_set_fd(3)), if we specify the effective
361 flag as being enabled for any capability, then the effective
362 flag must also be specified as enabled for all other capabili‐
363 ties for which the corresponding permitted or inheritable flags
364 is enabled.
365
366 Transformation of capabilities during execve()
367 During an execve(2), the kernel calculates the new capabilities of the
368 process using the following algorithm:
369
370 P'(permitted) = (P(inheritable) & F(inheritable)) |
371 (F(permitted) & cap_bset)
372
373 P'(effective) = F(effective) ? P'(permitted) : 0
374
375 P'(inheritable) = P(inheritable) [i.e., unchanged]
376
377 where:
378
379 P denotes the value of a thread capability set before the
380 execve(2)
381
382 P' denotes the value of a capability set after the execve(2)
383
384 F denotes a file capability set
385
386 cap_bset is the value of the capability bounding set (described
387 below).
388
389 Capabilities and execution of programs by root
390 In order to provide an all-powerful root using capability sets, during
391 an execve(2):
392
393 1. If a set-user-ID-root program is being executed, or the real user ID
394 of the process is 0 (root) then the file inheritable and permitted
395 sets are defined to be all ones (i.e., all capabilities enabled).
396
397 2. If a set-user-ID-root program is being executed, then the file
398 effective bit is defined to be one (enabled).
399
400 The upshot of the above rules, combined with the capabilities transfor‐
401 mations described above, is that when a process execve(2)s a set-user-
402 ID-root program, or when a process with an effective UID of 0
403 execve(2)s a program, it gains all capabilities in its permitted and
404 effective capability sets, except those masked out by the capability
405 bounding set. This provides semantics that are the same as those pro‐
406 vided by traditional UNIX systems.
407
408 Capability bounding set
409 The capability bounding set is a security mechanism that can be used to
410 limit the capabilities that can be gained during an execve(2). The
411 bounding set is used in the following ways:
412
413 * During an execve(2), the capability bounding set is ANDed with the
414 file permitted capability set, and the result of this operation is
415 assigned to the thread's permitted capability set. The capability
416 bounding set thus places a limit on the permitted capabilities that
417 may be granted by an executable file.
418
419 * (Since Linux 2.6.25) The capability bounding set acts as a limiting
420 superset for the capabilities that a thread can add to its inherita‐
421 ble set using capset(2). This means that if a capability is not in
422 the bounding set, then a thread can't add this capability to its
423 inheritable set, even if it was in its permitted capabilities, and
424 thereby cannot have this capability preserved in its permitted set
425 when it execve(2)s a file that has the capability in its inheritable
426 set.
427
428 Note that the bounding set masks the file permitted capabilities, but
429 not the inherited capabilities. If a thread maintains a capability in
430 its inherited set that is not in its bounding set, then it can still
431 gain that capability in its permitted set by executing a file that has
432 the capability in its inherited set.
433
434 Depending on the kernel version, the capability bounding set is either
435 a system-wide attribute, or a per-process attribute.
436
437 Capability bounding set prior to Linux 2.6.25
438
439 In kernels before 2.6.25, the capability bounding set is a system-wide
440 attribute that affects all threads on the system. The bounding set is
441 accessible via the file /proc/sys/kernel/cap-bound. (Confusingly, this
442 bit mask parameter is expressed as a signed decimal number in
443 /proc/sys/kernel/cap-bound.)
444
445 Only the init process may set capabilities in the capability bounding
446 set; other than that, the superuser (more precisely: programs with the
447 CAP_SYS_MODULE capability) may only clear capabilities from this set.
448
449 On a standard system the capability bounding set always masks out the
450 CAP_SETPCAP capability. To remove this restriction (dangerous!), mod‐
451 ify the definition of CAP_INIT_EFF_SET in include/linux/capability.h
452 and rebuild the kernel.
453
454 The system-wide capability bounding set feature was added to Linux
455 starting with kernel version 2.2.11.
456
457 Capability bounding set from Linux 2.6.25 onward
458
459 From Linux 2.6.25, the capability bounding set is a per-thread
460 attribute. (There is no longer a system-wide capability bounding set.)
461
462 The bounding set is inherited at fork(2) from the thread's parent, and
463 is preserved across an execve(2).
464
465 A thread may remove capabilities from its capability bounding set using
466 the prctl(2) PR_CAPBSET_DROP operation, provided it has the CAP_SETPCAP
467 capability. Once a capability has been dropped from the bounding set,
468 it cannot be restored to that set. A thread can determine if a capa‐
469 bility is in its bounding set using the prctl(2) PR_CAPBSET_READ opera‐
470 tion.
471
472 Removing capabilities from the bounding set is supported only if file
473 capabilities are compiled into the kernel. In kernels before Linux
474 2.6.33, file capabilities were an optional feature configurable via the
475 CONFIG_SECURITY_FILE_CAPABILITIES option. Since Linux 2.6.33, the con‐
476 figuration option has been removed and file capabilities are always
477 part of the kernel. When file capabilities are compiled into the ker‐
478 nel, the init process (the ancestor of all processes) begins with a
479 full bounding set. If file capabilities are not compiled into the ker‐
480 nel, then init begins with a full bounding set minus CAP_SETPCAP,
481 because this capability has a different meaning when there are no file
482 capabilities.
483
484 Removing a capability from the bounding set does not remove it from the
485 thread's inherited set. However it does prevent the capability from
486 being added back into the thread's inherited set in the future.
487
488 Effect of user ID changes on capabilities
489 To preserve the traditional semantics for transitions between 0 and
490 nonzero user IDs, the kernel makes the following changes to a thread's
491 capability sets on changes to the thread's real, effective, saved set,
492 and file system user IDs (using setuid(2), setresuid(2), or similar):
493
494 1. If one or more of the real, effective or saved set user IDs was pre‐
495 viously 0, and as a result of the UID changes all of these IDs have
496 a nonzero value, then all capabilities are cleared from the permit‐
497 ted and effective capability sets.
498
499 2. If the effective user ID is changed from 0 to nonzero, then all
500 capabilities are cleared from the effective set.
501
502 3. If the effective user ID is changed from nonzero to 0, then the per‐
503 mitted set is copied to the effective set.
504
505 4. If the file system user ID is changed from 0 to nonzero (see setf‐
506 suid(2)) then the following capabilities are cleared from the effec‐
507 tive set: CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH,
508 CAP_FOWNER, CAP_FSETID, CAP_LINUX_IMMUTABLE (since Linux 2.2.30),
509 CAP_MAC_OVERRIDE, and CAP_MKNOD (since Linux 2.2.30). If the file
510 system UID is changed from nonzero to 0, then any of these capabili‐
511 ties that are enabled in the permitted set are enabled in the effec‐
512 tive set.
513
514 If a thread that has a 0 value for one or more of its user IDs wants to
515 prevent its permitted capability set being cleared when it resets all
516 of its user IDs to nonzero values, it can do so using the prctl(2)
517 PR_SET_KEEPCAPS operation.
518
519 Programmatically adjusting capability sets
520 A thread can retrieve and change its capability sets using the
521 capget(2) and capset(2) system calls. However, the use of
522 cap_get_proc(3) and cap_set_proc(3), both provided in the libcap pack‐
523 age, is preferred for this purpose. The following rules govern changes
524 to the thread capability sets:
525
526 1. If the caller does not have the CAP_SETPCAP capability, the new
527 inheritable set must be a subset of the combination of the existing
528 inheritable and permitted sets.
529
530 2. (Since Linux 2.6.25) The new inheritable set must be a subset of the
531 combination of the existing inheritable set and the capability
532 bounding set.
533
534 3. The new permitted set must be a subset of the existing permitted set
535 (i.e., it is not possible to acquire permitted capabilities that the
536 thread does not currently have).
537
538 4. The new effective set must be a subset of the new permitted set.
539
540 The securebits flags: establishing a capabilities-only environment
541 Starting with kernel 2.6.26, and with a kernel in which file capabili‐
542 ties are enabled, Linux implements a set of per-thread securebits flags
543 that can be used to disable special handling of capabilities for UID 0
544 (root). These flags are as follows:
545
546 SECBIT_KEEP_CAPS
547 Setting this flag allows a thread that has one or more 0 UIDs to
548 retain its capabilities when it switches all of its UIDs to a
549 nonzero value. If this flag is not set, then such a UID switch
550 causes the thread to lose all capabilities. This flag is always
551 cleared on an execve(2). (This flag provides the same function‐
552 ality as the older prctl(2) PR_SET_KEEPCAPS operation.)
553
554 SECBIT_NO_SETUID_FIXUP
555 Setting this flag stops the kernel from adjusting capability
556 sets when the threads's effective and file system UIDs are
557 switched between zero and nonzero values. (See the subsection
558 Effect of User ID Changes on Capabilities.)
559
560 SECBIT_NOROOT
561 If this bit is set, then the kernel does not grant capabilities
562 when a set-user-ID-root program is executed, or when a process
563 with an effective or real UID of 0 calls execve(2). (See the
564 subsection Capabilities and execution of programs by root.)
565
566 Each of the above "base" flags has a companion "locked" flag. Setting
567 any of the "locked" flags is irreversible, and has the effect of pre‐
568 venting further changes to the corresponding "base" flag. The locked
569 flags are: SECBIT_KEEP_CAPS_LOCKED, SECBIT_NO_SETUID_FIXUP_LOCKED, and
570 SECBIT_NOROOT_LOCKED.
571
572 The securebits flags can be modified and retrieved using the prctl(2)
573 PR_SET_SECUREBITS and PR_GET_SECUREBITS operations. The CAP_SETPCAP
574 capability is required to modify the flags.
575
576 The securebits flags are inherited by child processes. During an
577 execve(2), all of the flags are preserved, except SECBIT_KEEP_CAPS
578 which is always cleared.
579
580 An application can use the following call to lock itself, and all of
581 its descendants, into an environment where the only way of gaining
582 capabilities is by executing a program with associated file capabili‐
583 ties:
584
585 prctl(PR_SET_SECUREBITS,
586 SECBIT_KEEP_CAPS_LOCKED |
587 SECBIT_NO_SETUID_FIXUP |
588 SECBIT_NO_SETUID_FIXUP_LOCKED |
589 SECBIT_NOROOT |
590 SECBIT_NOROOT_LOCKED);
591
593 No standards govern capabilities, but the Linux capability implementa‐
594 tion is based on the withdrawn POSIX.1e draft standard; see
595 ⟨http://wt.tuxomania.net/publications/posix.1e/⟩.
596
598 Since kernel 2.5.27, capabilities are an optional kernel component, and
599 can be enabled/disabled via the CONFIG_SECURITY_CAPABILITIES kernel
600 configuration option.
601
602 The /proc/PID/task/TID/status file can be used to view the capability
603 sets of a thread. The /proc/PID/status file shows the capability sets
604 of a process's main thread. Before Linux 3.8, nonexistent capabilities
605 were shown as being enabled (1) in these sets. Since Linux 3.8, all
606 non-existent capabilities (above CAP_LAST_CAP) are shown as disabled
607 (0).
608
609 The libcap package provides a suite of routines for setting and getting
610 capabilities that is more comfortable and less likely to change than
611 the interface provided by capset(2) and capget(2). This package also
612 provides the setcap(8) and getcap(8) programs. It can be found at
613 ⟨http://www.kernel.org/pub/linux/libs/security/linux-privs⟩.
614
615 Before kernel 2.6.24, and since kernel 2.6.24 if file capabilities are
616 not enabled, a thread with the CAP_SETPCAP capability can manipulate
617 the capabilities of threads other than itself. However, this is only
618 theoretically possible, since no thread ever has CAP_SETPCAP in either
619 of these cases:
620
621 * In the pre-2.6.25 implementation the system-wide capability bounding
622 set, /proc/sys/kernel/cap-bound, always masks out this capability,
623 and this can not be changed without modifying the kernel source and
624 rebuilding.
625
626 * If file capabilities are disabled in the current implementation, then
627 init starts out with this capability removed from its per-process
628 bounding set, and that bounding set is inherited by all other pro‐
629 cesses created on the system.
630
632 capget(2), prctl(2), setfsuid(2), cap_clear(3), cap_copy_ext(3),
633 cap_from_text(3), cap_get_file(3), cap_get_proc(3), cap_init(3),
634 capgetp(3), capsetp(3), libcap(3), credentials(7), pthreads(7), get‐
635 cap(8), setcap(8)
636
637 include/linux/capability.h in the Linux kernel source tree
638
640 This page is part of release 3.53 of the Linux man-pages project. A
641 description of the project, and information about reporting bugs, can
642 be found at http://www.kernel.org/doc/man-pages/.
643
644
645
646Linux 2013-07-21 CAPABILITIES(7)