Is there a way to undo a
chmod command on a directory in CentOS ?
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.