Powered By

Powered by Blogger

Kamis, 11 Februari 2010

RHEL: Chmod or Chown Issued By Mistake On System Folders [Fix]

Problem:
Permissions and Ownership on critical system files (in /etc/) directory modified. This may cause the system to not boot, lots of errors and Kernel Panic.

Cause:
Someone accidentally typed chmod -R 777 /etc.

Solution:
You may use the following solutions (if you use Chmod or Chown by mistake on System Folders and changed Permissions & Owners) to avoid the re-installation of whole RHEL O.S. This should work for any Red Hat Enterprise Linux version and what you have to do is reset the ownership and permissions of the files installed by RPM.


The RPM package manager maintains a database for all files that it installs onto the system. This includes information such as the filename, installation path, owning package and the file system ownership and permissions (including SELinux file context information). In the event that ownership or permissions are inadvertently changed, for example, through accidental misuse of the chown or chmod commands, it is possible to revert these to their values as stored in the database.

The command-line rpm tool provides the --setperms and --setugids switches to allow this to be done.

To re-set ownership and permissions for all packages on the system:
rpm --setperms -a
rpm --setugids -a


To re-set ownership and permissions for a specific package on the system:

rpm --setperms <package name>
rpm --setugids <package name>


Note: This will not restore ownership or permissions information for files that were not installed by an RPM package. Any incorrect ownership or permissions for user-owned files, or for packages installed outside of RPM control must be addressed separately.



This post was sent by Web Upd8 reader rkv (Credits: Purna) - thanks! You may also want to read his previous post: [How-To] Recover LVM Partition On Damaged HDD.

Tidak ada komentar:

Posting Komentar