I was trying to edit /etc/pam.d and fix elogind on my Artix Installation. Unfortunately, It went badly and I messed up my pam.d directory.However, I Found a Fix. In pacman, It is very easy to check files owned by packages. So, We can simply generate a list of packages which have files in pam.d and reinstall them.

Steps

  1. Remove Files to be regenerated
  2. Then, Stock Files are regenerated by using the following command:

For Bash Shell

pacman -S $(pacman -Ql | grep /etc/pam.d/$ | awk '{print $1}')

For Fish Shell

pacman -S (pacman -Ql | grep /etc/pam.d/\$ | awk '{print $1}')

This is very useful specially for rolling and bleeding edge distros. Using this you can regenerate directories. If you want regenerate a specific files just substitute /etc/pam.d/$ with the name of file.