setpriv - run a program with different Linux privilege settings


   setpriv [options] program [arguments]


   Sets  or  queries  various  Linux privilege settings that are inherited
   across execve(2).

   The difference between the commands setpriv and su (or runuser) is that
   setpriv  does  not  use open PAM session and does not ask for password.
   It's simple non-suid wrapper around execve syscall.


          Clear supplementary groups.

   -d, --dump
          Dump current privilege state.  Can be specified more  than  once
          to  show  extra, mostly useless, information.  Incompatible with
          all other options.

   --groups group...
          Set supplementary groups.  The  argument  is  a  comma-separated

   --inh-caps (+|-)cap...  or  --bounding-set (+|-)cap...
          Set the inheritable capabilities or the capability bounding set.
          See capabilities(7).  The argument is a comma-separated list  of
          +cap   and   -cap   entries,   which  add  or  remove  an  entry
          respectively.  +all and -all can be used to add  or  remove  all
          caps.   The  set  of  capabilities  starts  out  as  the current
          inheritable set for --inh-caps and the current bounding set  for
          --bounding-set.   If  you  drop  something from the bounding set
          without also dropping it  from  the  inheritable  set,  you  are
          likely to become confused.  Do not do that.

          Preserve  supplementary groups.  Only useful in conjunction with
          --rgid, --egid, or --regid.

          List all known capabilities.   This  option  must  be  specified

          Set the no_new_privs bit.  With this bit set, execve(2) will not
          grant new privileges.  For example, the setuid and  setgid  bits
          as  well  as  file  capabilities  will  be disabled.  (Executing
          binaries with these bits set will still work, but they will  not
          gain  privileges.  Certain LSMs, especially AppArmor, may result
          in failures to execute certain programs.)  This bit is inherited
          by  child  processes  and  cannot  be  unset.   See prctl(2) and
          Documentation/prctl/no_new_privs.txt in the Linux kernel source.

          The no_new_privs bit is supported since Linux 3.5.

   --rgid gid, --egid gid, --regid gid
          Set the real, effective, or both gids.  The gid argument can  be
          given as textual group name.

          For safety, you must specify one of --clear-groups, --groups, or
          --keep-groups if you set any primary gid.

   --ruid uid, --euid uid, --reuid uid
          Set the real, effective, or both uids.  The uid argument can  be
          given as textual login name.

          Setting  a uid or gid does not change capabilities, although the
          exec call at the end  might  change  capabilities.   This  means
          that, if you are root, you probably want to do something like:

                  setpriv --reuid=1000 --regid=1000 --caps=-all

   --securebits (+|-)securebit...
          Set  or  clear  securebits.   The  argument is a comma-separated
          list.   The  valid   securebits   are   noroot,   noroot_locked,
          no_setuid_fixup,  no_setuid_fixup_locked,  and keep_caps_locked.
          keep_caps is cleared by execve(2) and is therefore not allowed.

   --selinux-label label
          Request a particular SELinux transition (using a  transition  on
          exec,  not  dyntrans).   This  will fail and cause setpriv(1) to
          abort if SELinux is not  in  use,  and  the  transition  may  be
          ignored  or  cause  execve(2)  to  fail  at SELinux's whim.  (In
          particular,  this  is  unlikely  to  work  in  conjunction  with
          no_new_privs.)  This is similar to runcon(1).

   --apparmor-profile profile
          Request  a  particular  AppArmor  profile (using a transition on
          exec).  This will fail and cause setpriv(1) to abort if AppArmor
          is  not  in  use,  and  the  transition  may be ignored or cause
          execve(2) to fail at AppArmor's whim.

   -V, --version
          Display version information and exit.

   -h, --help
          Display help text and exit.


   If applying any specified option fails, program will  not  be  run  and
   setpriv will return with exit code 127.

   Be   careful  with  this  tool  --  it  may  have  unexpected  security
   consequences.  For example, setting no_new_privs  and  then  execing  a
   program  that  is  SELinux-confined (as this tool would do) may prevent
   the SELinux restrictions from taking effect.


   su(1), runuser(1), prctl(2), capability(7)


   Andy Lutomirski


   The setpriv command is part of the util-linux package and is  available
   from  Linux  Kernel Archive


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.