I made a mistake that resulted in the deletion of /etc/pam.d
, how do I restore the PAM configuration to the state that would be generated for my currently installed packages when I don't know the specific files to restore?
Asked
Active
Viewed 1.1k times
0

Ross Patterson
- 157
1 Answers
3
Use dpkg -S /etc/pam.d/*
to find out which packages installed PAM files/services, then use apt
to reinstall those packages and tell it to also install missing configuration files:
$ sudo apt install --reinstall -o Dpkg::Options::="--force-confmiss" $(dpkg -S /etc/pam.d/\* | cut -d ':' -f 1)
Thanks to @alvin-row for the bit on how to tell apt
to install missing configuration files

Ross Patterson
- 157
pam-auth-update
seems to be involved potentially (there are also some command that prompts about restoring the configs on some package updates, not sure which one that is now. (I mainly commented because that did not work for me) (I was mainly struggling with thecommon-*
configs – Gert van den Berg Jan 05 '23 at 09:45