Thursday, 11 December 2014

Tips For Restoring Permissions and ownership of Files in Redhat 6/7

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:
=========
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.
1. To re-set ownership and permissions for all packages on the system:
root@ubuntu12:~# rpm –setperms -a
root@ubuntu12:~# rpm –setugids -a
2. To re-set ownership and permissions for a specific package on the system
root@ubuntu12:~# rpm –setperms <package name>
root@ubuntu12:~# rpm –setugids <package name>
……………….OR …………..
1) To reset uids and gids on files and directories :
root@ubuntu~:# for u in $(rpm -qa); do rpm –setugids $u; done
2) To permissions on files and directories
root@ubuntu12:~# for p in $(rpm -qa); do rpm –setperms $p; done

Article Source - http://www.rhce.co.in/tips-for-restoring-permissions-and-ownership-of-files-in-redhat-67/

7 comments:

  1. very useful information. keep it up. visit for college essay, http://www.essaysbay.com/

    ReplyDelete
  2. ThIS wEB sITE nICE VISTE TO THIS wEB SITE http://funhousepk.com/

    ReplyDelete
  3. informasnya terms for the host
    https://bsontoso.wordpress.com/
    http://duniakuartikel.blogspot.com/

    ReplyDelete
  4. Wow thank you very much for this creative content, this has really helped me a lot,specially first post of this site.
    i was at this confused point in my numerology but after reading,this gave me more idea about how better my life could be.

    There are vast opportunities available for people who have childhood education degree. Many reputed institutions are appointing these people with excellent pay packages. Many family childcare home providers...........
    Click Here To Read More

    ReplyDelete
  5. I am extremely impressed along with your writing abilities and also with the format in your blog. Stay up to the excellent high quality writing, it's rare to find a nice weblog like this one these days.

    ReplyDelete
  6. I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.
    LINUX Training in Chennai

    ReplyDelete
  7. It’s always so sweet and also full of a lot of fun for me personally and
    my office colleagues to search your blog a minimum of thrice in a
    week to see the new guidance you have got.
    oracle apps dba training in Chennai
    best java training institute in Chennai
    node js developer course in Chennai

    ReplyDelete