2
I accidentally ran "chown -R ubuntu:ubuntu /" on a cluster of 10 servers. I've since managed to repair the majority of the filesystem by initially editing /etc/rc.local, placing a lot of chown commands in there, and rebooting.
At this time the systems appear to be working correctly, but I wanted to be sure I've fixed everything.
In order to identify the proper permissions, I booted up a fresh system with the same software installed, and looked up all files not owned by user:root, not owned by group:root, as well as all SUID and GUID bits.
Specifically, I ran these commands:
while read line; do user=$(echo $line |cut -d ":" -f 1); if [ $user != "root" ]; then echo ------${user}------; find / -user $user 2> /dev/null; fi; done < /etc/passwd
while read line; do user=$(echo $line |cut -d ":" -f 1); if [ $user != "root" ]; then echo ------${user}------; find / -group $user 2> /dev/null; fi; done < /etc/group
find / -perm -1000
find / -perm -2000
find / -perm -3000
find / -perm -4000
find / -perm -5000
find / -perm -6000
find / -perm -7000
And then manually made these changes to the affected systems.
My question is, did I miss anything, and are these systems now as good as a freshly installed system?
This is on Ubuntu 12.04.2 LTS.
Thanks.
1Please don't try
chmod -R a-x /
. – devnull – 2013-05-28T15:58:55.127In my opinion your recovery procedure looks good. I'ld additionally check which files are on your system that are not on the freshly installed system. These are the files that you missed and that might require a change. – Werner Henze – 2013-05-30T08:17:18.110