We installed Fedora 15 on a server using Kickstart. After using yum update, we found we could not login the server remotely. Because we were using ldap to authenticate users, and yum updated the files in the /etc/pam.d directory.
We need our previous configuration files, so I wrote a script to recover them, and modified the yum command to make yum to trigger the recovery script after run “yum update” each time. The following is what I did.
Create a recovery script
# vim /usr/local/bin/script1
echo “The following will be executed after yum update”
cp /root/system-auth-ac /etc/pam.d/system-auth-ac
cp /root/password-auth-ac /etc/pam.d/password-auth-ac
Make it executable
# chmod a+x /usr/local/bin/script1
Modify the /usr/bin/yum command file
Insert “import os” before “import sys”, and append the below at the end of the file
os.system(‘cp -f /root/yum /usr/bin/yum’)
if len(sys.argv) > 1 and “update” in sys.argv:
Backup the modified yum command file
# cp /usr/bin/yum /root