DH_TESTROOT(1)                    Debhelper                   DH_TESTROOT(1)

NAME         top

       dh_testroot - ensure that a package is built with necessary level of
       root permissions

SYNOPSIS         top

       dh_testroot [debhelper options]

DESCRIPTION         top

       dh_testroot is used to determine if the package has access to at
       least the level of root access that it declared it needed via the
       Rules-Requires-Root (R³) field.

       The following is how dh_testroot behaves based on the effective value
       of the R³ field:

           dh_testroot asserts that it is run as root or under fakeroot(1).

           dh_testroot returns successfully.

       Any other value than the above
           dh_testroot asserts that it is either run as root (or under
           fakeroot(1)) or the builder has provided the DEB_GAIN_ROOT_CMD
           environment variable (e.g. via dpkg-buildpackage -r).

       For backwards compatibility, dh_testroot will consider the absence of
       the R³ field as if the R³ field was set to "binary-targets".

SEE ALSO         top


       This program is a part of debhelper.

AUTHOR         top

       Joey Hess <>

COLOPHON         top

       This page is part of the debhelper (helper programs for debian/rules)
       project.  Information about the project can be found at 
       ⟨⟩.  If you
       have a bug report for this manual page, send it to  This page was obtained from the project's
       upstream Git repository
       ⟨⟩ on
       2018-04-30.  (At that time, the date of the most recent commit that
       was found in the repository was 2018-01-28.)  If you discover any
       rendering problems in this HTML version of the page, or you believe
       there is a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to

11.1.4                           2018-01-23                   DH_TESTROOT(1)