Which package provides a certain configuration file?
dpkg -S
will only find configuration files which are shipped directly in packages, not those which are generated by maintainer scripts (or other tools). There’s no general solution for the latter, but looking for references to the file in /var/lib/dpkg/info
is your best bet. In this instance:
$ grep -rl /etc/samba/smb.conf /var/lib/dpkg/info
/var/lib/dpkg/info/samba-common.config
/var/lib/dpkg/info/samba-common.postinst
/var/lib/dpkg/info/samba-common.postrm
/var/lib/dpkg/info/samba-common.templates
This suggests that the file is managed by samba-common
; reading the postinst
file will confirm that.
Stephen Kitt's answer is probably the best, but if you can't find it like that, you can also try etckeeper
. This is not installed by default on Debian and Ubuntu, but it is in the repo's so a simple apt install etckeeper
should do it.
Etckeeper puts your /etc
under (git) version control. One of the things it does is make an automatic commit every time you install/update a package.
Now you can use cd /etc && sudo git blame somefile
to see when it was adjusted and search that date in /var/log/dpkg*
It's a lot of work, but it should work when dpkg -S
doesn't find it.