# Reset pam.d Modules

I managed to bork my pam.d configs to the point that I couldn't root or sudo to gain access to reset them. In my shame, I had to create a new install USB and chroot in. Thankfully I haven't figured out drive encryption yet or I may have been SOL, I haven't the foggiest idea. This is on arch btw. 

Edit 9/9/22: just use `cryptsetup open ...` to decrypt the drive then follow this guide

[Create](https://wiki.archlinux.org/title/USB_flash_installation_medium) and boot into an install USB

List all the available partitions </br>
`fdisk-l`

Mount the root partition -  [guide](https://wiki.archlinux.org/title/installation_guide#Mount_the_file_systems) </br>
`mount /dev/nvme1n1p3 /mnt`

Copy the pam configs from the install USB to the broken system. </br>
`mkdir /mnt/pam.d` </br>
`cp -R /etc/pam.d /mnt/pam.d`

Root into the file system </br>
`arch-chroot /mnt`

Backup the screwed-up pam configs to someplace convienty. </br>
`mv /etc/pam.d /home/User/Downloads`

move the stock configs in
`mv /pam.d /etc/`

Reboot and remove install USB

KDE will fail to load because its pam modules aren't in the stock pam.d folder. Hopefully, you can manage to un-bork those.

`ctl` +`alt` + `F2` to exit to command line.

Login and head over to the borked files

`cd Downloads/pam.d`

Remove the edits from:
- cron.d
- ssdm
- ssdm-greeter
- sddm-autologin
- kde

Move those configs back to the etc folder. </br>
`sudo cp sddm /etc/pam.d` - etc

Delete the unnessesary configs used by the installer. </br>
`sudo rm vmtoolsd partimaged`

Restart Xorg to login to the desktop (or restart)
sudo kill -9 Xorg

Success?

