I recently changed some pamd settings because I wanted my ssh keys unlocked at login. I followed the instructions at this wiki page.

Ignoring the warning, I have become locked out (cannot log in with user account or even root also in safe mode).

How can this be fixed? I have a live CD for arch linux, but I`m hoping a reinstall is not necessary.

  • Boot from live CD. Mount your root partition (e.g. mount /dev/sda2 /mnt). Edit PAM configs under /mnt/etc/pam.d). – Mikel May 13 '12 at 16:36
  • heh that easy! why do we go trough all the trouble of securing our pc's. Let's hope this works. – romeovs May 13 '12 at 16:41
  • Many of us go through loads of trouble securing computers physically too, because once someone has physical access to the console, much of logical security is largely irrelevant. But it's still a whole lot easier to do it over the network than to travel to your location with a large hammer (or a rescue CD and bad intentions). :) – Alexios May 13 '12 at 16:57
  • This is why system encryption (i.e. encrypting the root file system) is important. – Mikel May 13 '12 at 17:08

This can be fixed with a CD as Mikel suggested, but you can also do this without a CD.

  1. You can pass init=/bin/sh as an argument to the kernel (in the bootloader) to launch a shell.
  2. Once you have the shell, do mount -o remount,rw / to remount the root filesystem read/write.
  3. Edit the pam config to fix the issue.
  4. Reboot

Note this procedure is dependent upon your distribution. If you have a distribution which ships with a special initramfs, then init=/bin/sh might not work. In this case you should look up how to get a rescue shell in the initramfs (in your distro's documentation).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.