Accidentally ran "chown -R ubuntu:ubuntu /", how to repair?
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:
1)
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
2)
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
3)
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.
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:
1)
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
2)
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
3)
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.
No comments:
Post a Comment