SETPRIV(1) SETPRIV(1) setpriv - setpriv [] [] execve(2). su(1) runuser(1), setpriv PAM, . - execve(2) setuidgid(8) daemontools, chpst(8) runit, . --clear-groups . -d, --dump . , , . . --groups ... . - . --inh-caps (+|-)..., --ambient-caps (+|-)..., --bounding-set (+|-)... , . capabilities(7). +cap -cap, . cap capabilities(7) cap_ cap_N, N . +all -all . --inh-caps, --ambient-caps --bounding-set. ( capabilities(7)) : o . o . o setpriv, . , , . . --keep-groups . --rgid, --egid, --regid. --init-groups ,,initgroups3". --ruid --reuid. --list-caps . . --nnp, --no-new-privs no_new_privs. , execve(2) . , -- --, . ( , . LSM-, AppArmor, .) . prctl(2) Documentation/prctl/no_new_privs.txt . __ 3.5. --rgid , --egid , --regid , , -. . , --clear-groups, --groups, --keep-groups, --init-groups . --ruid , --euid , --reuid , , -. . - - , . , , : setpriv --reuid=1000 --regid=1000 --inh-caps=-all --securebits (+|-)-... . . noroot, noroot_locked, no_setuid_fixup, no_setuid_fixup_locked, keep_caps_locked. keep_caps execve-(2) . --pdeathsig keep|clear|<> , . LSM-, AppArmor, . --pdeathsig keep . --ptracer |any|none ,,ptrace" Yama- ( ,, /proc/sys/kernel/yama/ptrace_scope 1), ptrace(2) -, , . PR_SET_PTRACER(2const). ( , execve(2).) Yama ,,ptrace"-. --selinux-label ( ,,exec"-, ,,dyntrans"-). setpriv- , execve(2) . (, no_new_privs.) runcon(1). --apparmor-profile AppArmor ( ). setpriv AppArmor , execve(2) AppArmor-. --landlock-access ,,landlock" . --landlock-rule. : setpriv --landlock-access : setpriv --landlock-access :remove-file,make-dir setpriv --help. The generic placeholder "fs" is subject to change and may be extended in future versions to support new access types. --landlock-rule --landlock-access. : --landlock-rule $_:$:$_ /boot: --landlock-rule -:-:/boot --seccomp-filter ,,BPF seccomp" . enosys. --reset-env o clears all the environment variables except TERM environment variable o initializes the environment variables HOME, SHELL, USER, LOGNAME according to the user's passwd entry o the environment variable SHELL defaults to /bin/sh if none is given in the user's passwd entry. o resets PATH environment variable according to setting in /etc/login.defs (ENV_PATH, ENV_SUPATH or ENV_ROOTPATH variables), or defaults to /usr/local/bin:/bin:/usr/bin for a regular user and to /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin for root. The environment variable PATH may be different on systems where /bin and /sbin are merged into /usr. -h, --help . -V, --version . , setpriv 127. - . , no_new_privs ( ) . Note that setpriv is not a 1:1 replacement for su(1), runuser(1), or sudo(8). Unlike those tools, setpriv does not use PAM, does not prompt for a password, and does not perform session or accounting setup. The examples below provide a starting point for common privilege-dropping scenarios. If you want to switch UIDs/GIDs similarly to runuser(1) (without --login), try: setpriv --reuid=1000 --regid=1000 --inh-caps=-all --init-groups To also reset the environment (as sudo(8) does by default), add --reset-env: setpriv --reuid=1000 --regid=1000 --inh-caps=-all --init-groups --reset-env For a more restrictive setup that also limits the bounding set and prevents gaining new privileges (more restrictive than runuser or sudo): setpriv --reuid=1000 --regid=1000 --init-groups --inh-caps=-all --bounding-set=-all --no-new-privs --reset-env setuid(8) , : setpriv --reuid=1000 --regid=1000 --clear-groups Andy Lutomirski runuser(1), su(1), prctl(2), capabilities(7), landlock(7) , ,,https://github.com/util-linux/util-linux/issues[issue tracker]". setpriv ,,util-linux" . util-linux 2.42.3 2026-09-02 SETPRIV(1)