In my Centos 7 machine, and as an inexplicable mistake, I ran:

rm  /etc/pam.d/system-auth

Now, my system won't boot up, the network does not work, and in a few words, the system is trashed.

I tried to fix the problem with single user mode and running

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

This did not make any change and, after rebooting, my system is still not working.

The only solution that I found involves restoring the symlink from emergency mode, the challenge is, that emergency mode requires the root password which I don't have, and I don't seem to be able to change it from single user mode.

 Steps to reproduce:

 In a new CentOS installation:

• sudo rm  /etc/pam.d/system-auth    
• Restart    
• You will notice that the system won't reach the login page(if Gnome or KDE are enabled). Otherwise, you will reach the login page but it won't work even if you have the right credentials. 

Error I received I tried to login in emergency mode after I changed the root password in single user mode.

Steps trying to fix it : 
• Enter single user mode enabling it with rw init=/bin/bash
• ln -s  /etc/pam.d/system-auth-ac /etc/pam.d/system-auth

Thank you

  • The file /etc/pam.d/system-auth is normally a symlink to /etc/pam.d/system-auth-ac, so restoring that symlink should fix your problem. The symlink's permissions are meaningless, as a symlink they'll be 777. Perhaps there was something else you did when you deleted that file? – jsbillings May 13 '17 at 12:37
  • @jsbillings I guarantee you that that's all I did. I created a new machine and reproduced the steps and it created the same problem. Reproducing the symlink did not make any difference – Yeikel May 13 '17 at 15:47
  • @jsbillings I added more details to support my question in case you can help. Thank you! – Yeikel May 14 '17 at 20:42
  • I can't reproduce your problem. I installed CentOS 7 1611 from a minimal ISO, logged in and deleted /etc/pam.d/system-auth, and rebooted, and it does break logins, but booting into init=/bin/bash lets me restore the symlink and log in after resetting the computer. – jsbillings May 15 '17 at 13:53

Don't forget selinux. Sestatus may tell you.

I'm not good enough with selinux. So if sestatus says enforcing, then

sed -i~ '/SELINUX=/s/=.*/=permissive/' /etc/selinux/config

and the reboot should kick it into allowing that system-auth to be used.

It's not an awesome fix if your home/shop loves it some selinux, but you should/can figure out the proper context to spackle around system-auth, relabel that, re-enable selinux on the box, bounce again and move on.

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.