]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/setpriv.1
libfdisk: accept Start offset in {B,M,G..}iB in sfdisk scripts
[thirdparty/util-linux.git] / sys-utils / setpriv.1
CommitLineData
cf8e0bae 1.TH SETPRIV 1 "July 2014" "util-linux" "User Commands"
5600c405
AL
2.SH NAME
3setpriv \- run a program with different Linux privilege settings
4.SH SYNOPSIS
5.B setpriv
cf8e0bae
BS
6[options]
7.I program
5600c405
AL
8.RI [ arguments ]
9.SH DESCRIPTION
10Sets or queries various Linux privilege settings that are inherited across
11.BR execve (2).
12.SH OPTION
13.TP
5e43af7e
BS
14.B \-\-clear\-groups
15Clear supplementary groups.
16.TP
17.BR \-d , " \-\-dump"
cf8e0bae
BS
18Dump current privilege state. Can be specified more than once to show extra,
19mostly useless, information. Incompatible with all other options.
5600c405 20.TP
5e43af7e
BS
21.B \-\-groups \fIgroup\fR...
22Set supplementary groups. The argument is a comma-separated list.
5600c405 23.TP
5e43af7e 24.BR \-\-inh-caps " (" + | \- ) \fIcap "... or " \-\-bounding\-set " (" + | \- ) \fIcap ...
cf8e0bae 25Set the inheritable capabilities or the capability bounding set. See
5600c405
AL
26.BR capabilities (7).
27The argument is a comma-separated list of
cf8e0bae 28.BI + cap
5600c405 29and
cf8e0bae 30.BI \- cap
5600c405 31entries, which add or remove an entry respectively.
cf8e0bae 32.B +all
5600c405 33and
cf8e0bae 34.B \-all
5600c405
AL
35can be used to add or remove all caps. The set of capabilities starts out as
36the current inheritable set for
cf8e0bae 37.B \-\-inh\-caps
5600c405 38and the current bounding set for
cf8e0bae 39.BR \-\-bounding\-set .
5600c405
AL
40If you drop something from the bounding set without also dropping it from the
41inheritable set, you are likely to become confused. Do not do that.
42.TP
5e43af7e
BS
43.B \-\-keep\-groups
44Preserve supplementary groups. Only useful in conjunction with
45.BR \-\-rgid ,
46.BR \-\-egid ", or"
47.BR \-\-regid .
48.TP
5600c405 49.BR \-\-list\-caps
cf8e0bae 50List all known capabilities. This option must be specified alone.
5600c405 51.TP
5e43af7e
BS
52.B \-\-no-new-privs
53Set the
54.I no_new_privs
55bit. With this bit set,
56.BR execve (2)
57will not grant new privileges. For example, the setuid and setgid bits as well
58as file capabilities will be disabled. (Executing binaries with these bits set
59will still work, but they will not gain privileges. Certain LSMs, especially
60AppArmor, may result in failures to execute certain programs.) This bit is
61inherited by child processes and cannot be unset. See
62.BR prctl (2)
63and
64.IR Documentation/\:prctl/\:no_\:new_\:privs.txt
65in the Linux kernel source.
66.sp
67The no_new_privs bit is supported since Linux 3.5.
68.TP
69.BI \-\-rgid " gid\fR, " \-\-egid " gid\fR, " \-\-regid " gid"
70Set the real, effective, or both gids. The \fIgid\fR argument can be
71given as textual group name.
72.sp
73For safety, you must specify one of
74.BR \-\-clear-groups ,
75.BR \-\-groups ", or"
76.BR \-\-keep-groups
77if you set any primary
78.IR gid .
79.TP
80.BI \-\-ruid " uid\fR, " \-\-euid " uid\fR, " \-\-reuid " uid"
cf8e0bae 81Set the real, effective, or both uids. The \fIuid\fR argument can be
637fa4c6 82given as textual login name.
5e43af7e
BS
83.sp
84Setting a
5600c405
AL
85.I uid
86or
87.I gid
88does not change capabilities, although the exec call at the end might change
89capabilities. This means that, if you are root, you probably want to do
90something like:
5e43af7e
BS
91.sp
92.B " setpriv \-\-reuid=1000 \-\-regid=1000 \-\-caps=\-all"
5600c405 93.TP
5e43af7e 94.BR \-\-securebits " (" + | \- ) \fIsecurebit ...
cf8e0bae
BS
95Set or clear securebits. The argument is a comma-separated list.
96The valid securebits are
5600c405 97.IR noroot ,
cf8e0bae
BS
98.IR noroot_locked ,
99.IR no_setuid_fixup ,
100.IR no_setuid_fixup_locked ,
5600c405 101and
cf8e0bae
BS
102.IR keep_caps_locked .
103.I keep_caps
5600c405
AL
104is cleared by
105.BR execve (2)
106and is therefore not allowed.
107.TP
5e43af7e 108.BI \-\-selinux-label " label"
cf8e0bae 109Request a particular SELinux transition (using a transition on exec, not
5600c405
AL
110dyntrans). This will fail and cause
111.BR setpriv (1)
112to abort if SELinux is not in use, and the transition may be ignored or cause
113.BR execve (2)
114to fail at SELinux's whim. (In particular, this is unlikely to work in
115conjunction with
cf8e0bae 116.IR no_new_privs .)
5600c405
AL
117This is similar to
118.BR runcon (1).
119.TP
5e43af7e 120.BI \-\-apparmor-profile " profile"
cf8e0bae 121Request a particular AppArmor profile (using a transition on exec). This will
5600c405
AL
122fail and cause
123.BR setpriv (1)
124to abort if AppArmor is not in use, and the transition may be ignored or cause
125.BR execve (2)
126to fail at AppArmor's whim.
127.TP
5e43af7e 128.BR \-V , " \-\-version"
5600c405
AL
129Display version information and exit.
130.TP
5e43af7e 131.BR \-h , " \-\-help"
b4362b6f 132Display help text and exit.
5600c405
AL
133.SH NOTES
134If applying any specified option fails,
135.I program
136will not be run and
137.B setpriv
138will return with exit code 127.
139.PP
140Be careful with this tool \-\- it may have unexpected security consequences.
cf8e0bae
BS
141For example, setting no_new_privs and then execing a program that is
142SELinux\-confined (as this tool would do) may prevent the SELinux
5600c405
AL
143restrictions from taking effect.
144.SH SEE ALSO
66083665 145.BR prctl (2),
5600c405
AL
146.BR capability (7)
147.SH AUTHOR
148.MT luto@amacapital.net
149Andy Lutomirski
150.ME
151.SH AVAILABILITY
152The
153.B setpriv
154command is part of the util-linux package and is available from
155.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
156Linux Kernel Archive
157.UE .