1CAPSH(1) User Commands CAPSH(1)
2
3
4
6 capsh - capability shell wrapper
7
9 capsh [OPTION]...
10
12 Linux capability support and use can be explored and constrained with
13 this tool. This tool provides a handy wrapper for certain types of
14 capability testing and environment creation. It also provides some
15 debugging features useful for summarizing capability state.
16
18 The tool takes a number of optional arguments, acting on them in the
19 order they are provided. They are as follows:
20
21 --print Display prevailing capability and related state.
22
23 -- [args] Execute /bin/bash with trailing arguments.
24
25 == Execute capsh again with remaining arguments.
26 Useful for testing exec() behavior.
27
28 --caps=cap-set Set the prevailing process capabilities to those
29 specified by cap-set. Where cap-set is a text-
30 representation of capability state as per
31 cap_from_text(3).
32
33 --drop=cap-list Remove the listed capabilities from the prevail‐
34 ing bounding set. The capabilites are a comma
35 separated list of capabilities as recognized by
36 the cap_from_name(3) function. Use of this fea‐
37 ture requires that the capsh program is operating
38 with CAP_SETPCAP in its effective set.
39
40 --inh=cap-list Set the inheritable set of capabilities for the
41 current process to equal those provided in the
42 comma separated list. For this action to succeed,
43 the prevailing process should already have each
44 of these capabilities in the union of the current
45 inheritable and permitted capability sets, or the
46 capsh program is operating with CAP_SETPCAP in
47 its effective set.
48
49 --uid=id Force all uid values to equal id using the
50 setuid(2) system call.
51
52 --keep=<0|1> In a non-pure capability mode, the kernel pro‐
53 vides liberal privilege to the super-user. How‐
54 ever, it is normally the case that when the
55 super-user changes uid to some lesser user, then
56 capabilities are dropped. For these situations,
57 the kernel can permit the process to retain its
58 capabilities after a setuid(2) system call. This
59 feature is known as keep-caps support. The way to
60 activate it using this script is with this argu‐
61 ment. Setting the value to 1 will cause keep-caps
62 to be active. Setting it to 0 will cause keep-
63 caps to deactivate for the current process. In
64 all cases, keep-caps is deactivated when an
65 exec() is performed. See --secbits for ways to
66 disable this feature.
67
68 --secbits=N XXX - need to document this feature.
69
70 --chroot=path Execute the chroot(2) system call with the new
71 root-directory (/) equal to path. This operation
72 requires CAP_SYS_CHROOT to be in effect.
73
74 --forkfor=sec
75
76 --killit=sig
77
78 --decode=N This is a convenience feature. If you look at
79 /proc/1/status there are some capability related
80 fields of the following form:
81
82 CapInh: 0000000000000000
83 CapPrm: ffffffffffffffff
84 CapEff: fffffffffffffeff
85 CapBnd: ffffffffffffffff
86
87 This option provides a quick way to decode a
88 capability vector represented in this form. For
89 example, the missing capability from this effec‐
90 tive set is 0x0100. By running:
91
92 capsh --decode=0x0100
93
94 we observe that the missing capability is:
95 cap_setpcap.
96
97
98 EXIT STATUS
99 Following successful execution the tool exits with status 0.
100 Following an error, the tool immediately exits with status 1.
101
103 Written by Andrew G. Morgan <morgan@kernel.org>.
104
106 Please report bugs to the author.
107
109 libcap(3), getcap(8),setcap(8) and capabilities(7).
110
111
112
113libcap 2 2011-04-24 CAPSH(1)