What exactly does this dpkg command do?
I fixed a permissin problem for nagios like discribed here.
The command was:
sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
Okay its obvious that it is some sort of permission altering. But where does it take place? Where is it stored? Is it just a chmod modification?
Solution 1:
dpkg-statoverride
is the management tool for a database maintained by dpkg that contains owner and mode settings for given file paths.
Invoked as in your question, it will do two things: Set the owenrship/mode for the given files immediately if they exist (--update
) and store a new entry in the override file (--add
). The latter ensures that further dpkg
operations that create or modify the listed files will use the override values rather than those defined by the package.
These overrides are permanent. They typically beats a normal chmod/chown
since it saves you having to remember to reset the permissions manually when you update or reinstall the package.
Existing overrides can be listed by running dpkg-statoverride --list
.
Solution 2:
You could just do it manually. It is simply a change of permissions. The reason for using dpkg-statoverride is that it will remember it on updates and such.
It's a tool to tell dpkg to use those permissions. You are actually able to set it before installing the package as well.
The --update flag is used when changing permissions through dpkg-statoverride on files that already exists.