I've been setting up a hosting platform on a VPS running Centos 7. I've been going through some admin tasks and accidentally ran a couple commands within the /etc directory:

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

I know how potentially grave a mistake this is but upon using ls -lR within /etc I found that these changes had been far from universally implemented. There is still a ton of nuance in the permissions of the files and directories within /etc.

I know it would be diligent to nevertheless reinstall Centos on this VPS, but before I do, can anyone explain why the ls -lR command is showing me tons of variation in the permissions of /etc? Is it possible the commands were malformed or didn't actually execute?

I've also reviewed other similar questions and solutions such as rpm --setperms don't seem helpful here since that would only reset the permissions on rpm-installed packages. Any advice is greatly appreciated.

If you'd like to see any output, logs, or need more info I'll update the question with it.

  • Well IIRC find doesn't follow symlinks by default - maybe that's what you're observing? – steeldriver Mar 24 '18 at 1:36
  • I wasn't aware of that so yes I would suppose that explains it... I had hoped there was some magic that could save me here but I've accepted my fate now – baelx Mar 25 '18 at 19:26
  • Did you run these commands as root? – Kusalananda Apr 8 '18 at 15:35

I'm afraid there was no magic bullet here - given that I couldn't know the extent of the damage, I was forced to reinstall my system. Thanks to those who commented.

| improve this answer | |
  • It's a shame we never got to know whether you executed the find commands as root or not. If you did not, then no harm would have been done. Also, any backup solution should have included a backup of /etc along with other essential system files. – Kusalananda Jun 20 '18 at 5:46

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.