Is there a way to undo a chmod command on a directory in CentOS ?


The answer is simple,
No it's not and if you still get the list of your authorization, then you can only restore them through a script or manually.


No, the only way how to revert chmod changes is from backup. Or maybe if these files come from an rpm package use rpm --setperms.

  • Backup is also an option I forget this one I never save file permission in my backups :D now I see I should
    – Kiwy
    Feb 26 '14 at 10:38

If the directory is part of the system or an installed package managed by rpm you can find out which package it is part of with rpm -qf /directory and then can try rpm -qV <package> (verify) to see what the installed permissions settings were. You can then revert to those with chmod manually or with rpm --setperms as stderr mentioned.

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.