Unable to run 'su' and 'sudo' after changing permissions on /etc

Hello,
I'm running rhel6 64bit. Accidentally I ran

% chmod -R 777 /etc

and after that I have a problem to do 'su' or 'sudo'. When I did sudo it complained that /etc/sudoers has 777 while it should be 0440. I changed that and also restored right permission for:

-rw-r--r-- 1 root root 1966 May 19 13:41 /etc/passwd
-r-------- 1 root root 1161 May 19 13:42 /etc/shadow
-r--r----- 1 root root 3746 Apr 23 01:38 /etc/sudoers

Anyway it failed to 'su'. Then I restored back permissions on files in /etc/security and /etc/sysconfig. Still can't do 'su'. Note: I could login from console as root but can't 'su' or 'sudo'.
when I do 'su' it gives error:

Password: 
su: incorrect password

Could someone help with it?
Thanks.

found this from a quick google search. verify this works with one lesser needed package before executing. HTH

https://lists.sdsc.edu/pipermail/npaci-rocks-discussion/2007-April/024488.html

1 Like

thanks for reply, your links looks very interesting and I'd definitely try it if I would complete stuck ... but fortunately I was able to restore permission for some pam files and /etc/shell which solved the issue.
I'm all set ... was able to fix it.
susja