# dpkg manual page - dpkg-statoverride(1)
#
# Copyright © 2000-2001 Wichert Akkerman <wakkerma@debian.org>
# Copyright © 2009-2011, 2013, 2015 Guillem Jover <guillem@debian.org>
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

=encoding utf8

=head1 NAME

dpkg-statoverride - override ownership and mode of files

=head1 SYNOPSIS

B<dpkg-statoverride>
[I<option>...] I<command>

=head1 DESCRIPTION

“B<stat overrides>” are a way to tell
L<dpkg(1)>
to use a different owner
or mode for a path when a package is installed (this applies to any
filesystem object that
B<dpkg>
handles, including directories, devices, etc.). This can be used to
force programs that are normally setuid to be install without a setuid
flag, or only executable by a certain group.

B<dpkg-statoverride> is a utility to manage the list of stat
overrides. It has three basic functions: adding, removing and listing
overrides.

=head1 COMMANDS

=over

=item B<--add> I<user group mode path>

Add an override for I<path>. I<path> does not need to exist nor be known to
B<dpkg> when this command is used; the override will be stored and used later.
Users and groups can be specified by their name (for example B<root>
or B<nobody>), or by their number by prepending the number with a
‘B<#>’ (for example B<#0> or B<#65534>).
The I<mode> needs to be specified in octal.

If B<--update> is specified and I<path> exists, it is immediately
set to the new owner and mode.

=item B<--remove> I<path>

Remove an override for I<path>, the status of I<path> is left
unchanged by this command.

=item B<--list> [I<glob-pattern>]

List all overrides. If a glob pattern is specified restrict the output
to overrides which match the glob.

=item B<--help>

Show the usage message and exit.

=item B<--force-help>

Give help about the B<--force->I<thing> options (since dpkg 1.19.5).

=item B<--version>

Show the version and exit.

=back

=head1 OPTIONS

=over

=item B<--admindir> I<directory>

Set the administrative directory to I<directory>.
This is where the I<statoverride> file is stored.
Defaults to «I<%ADMINDIR%>» if B<DPKG_ADMINDIR> has not been set.

=item B<--instdir> I<directory>

Set the installation directory, which refers to the directory where
packages get installed (since dpkg 1.19.2).
Defaults to «I</>» if B<DPKG_ROOT> has not been set.

=item B<--root> I<directory>

Set the root directory to B<directory>, which sets the installation
directory to «I<directory>» and the administrative
directory to «I<directory>B<%ADMINDIR%>» (since dpkg 1.19.2)
if B<DPKG_ROOT> has not been set.

=item B<--force->I<things>

=item B<--no-force->I<things>, B<--refuse->I<things>

Force or refuse (B<no-force> and B<refuse> mean the same thing)
to do some things (since dpkg 1.19.5).
I<things> is a comma separated list of things specified below.
B<--force-help> displays a message describing them.
Things marked with (*) are forced by default.

B<Warning>: These options are mostly intended to be used by experts only.
Using them without fully understanding their effects may break your whole
system.

=over 4

=item B<all>:

Turns on (or off) all force options.

=item B<statoverride-add>:

Overwrite an existing stat override when adding it (since dpkg 1.19.5).

=item B<statoverride-remove>:

Ignore a missing stat override when removing it (since dpkg 1.19.5).

=item B<security-mac>(*):

Use platform-specific Mandatory Access Controls (MAC) based security when
installing files into the filesystem (since dpkg 1.19.5).
On Linux systems the implementation uses SELinux.

=item B<not-root>:

Try to (de)install things even when not root (since dpkg 1.21.8).

=back

=item B<--force>

Force an action, even if a sanity check would otherwise prohibit it.
This is necessary to override an existing override.
This option is deprecated (since dpkg 1.19.5), it is replaced by
B<--force-all>.

=item B<--update>

Immediately try to change the I<path> to the new owner and mode if it
exists.

=item B<--quiet>

Be less verbose about what we do.

=back

=head1 EXIT STATUS

=over

=item B<0>

The requested action was successfully performed.

=item B<1>

For B<--list>, if there are no overrides or none match the supplied
glob.

=item B<2>

Fatal or unrecoverable error due to invalid command-line usage, or
interactions with the system, such as accesses to the database,
memory allocations, etc.

=back

=head1 ENVIRONMENT

=over

=item B<DPKG_ROOT>

If set and the B<--instdir> or B<--root> options have not been
specified, it will be used as the filesystem root directory
(since dpkg 1.19.2).

=item B<DPKG_ADMINDIR>

If set and the B<--admindir> or B<--root> options have not been
specified, it will be used as the B<dpkg> data directory.

=item B<DPKG_DEBUG>

Sets the debug mask (since dpkg 1.21.10) from an octal value.
The currently accepted flags are described in the B<dpkg --debug> option,
but not all these flags might have an effect on this program.

=item B<DPKG_FORCE>

If set and none of the B<--force->I<...> options have been
specified, it will be used as the force options to use (since dpkg 1.19.5).

=item B<DPKG_COLORS>

Sets the color mode (since dpkg 1.18.5).
The currently accepted values are: B<auto> (default), B<always> and
B<never>.

=back

=head1 FILES

=over

=item I<%ADMINDIR%/statoverride>

File which contains the current list of stat overrides of the system. It
is located in the B<dpkg> administration directory, along with other files
important to B<dpkg>, such as I<status> or I<available>.

B<Note>: B<dpkg-statoverride> preserves the old copy of this file, with
extension “-old”, before replacing it with the new one.

=back

=head1 SEE ALSO

L<dpkg(1)>.
