Situation: Poking around some system files in /etc/

Problem: I managed to accidentally rm-ed some files, including /etc/pam.d/password-auth and /etc/pam.d/system-auth (don't ask...)

Question: What are the ramifications (if any) of removing such files? I dare not log out or reboot for now.

Additional information: Machine is running CentOS 7. Will also be interested to know ramifications on top of just replacing the files.

  • 2
    Don't log out. Don't reboot. Please tell us exactly what version of Unix or the distribution of Linux you're using, so someone can tell you where/how to get those files back – roaima Oct 27 '20 at 7:13
  • @roaima updated my question. It's CentOS 7 – Timothy Wong Oct 27 '20 at 8:38

Assuming you've still got root, this will restore the two files you've named

cd /etc/pam.d
ln -s password-auth-ac password-auth
ln -s system-auth-ac system-auth

Test by using a new session to login with ssh. (If necessary, ssh localhost from the machine itself.) If the login succeeds then you've fixed it - without these files you cannot authenticate or authorise any session for any work. (In the /etc/pam.d directory you can grep -l system-auth * and grep -l password-auth * to see which services were affected. It makes for unpleasant reading.)

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.