Restore Linux file Permission

File permissions in Linux got changed accidentally (chmod -R 777 / Linux system files incorrectly configured).
Due to incorrect file permission on Linux file system may cause troubles to boot or load services, Restoring file permission to default level is quite complicated but below steps shall retrieve your Linux machine.

Step 1 : Run the commands to revert back  uids and gids on files and directories

Step 2 : Run the command to revert back permissions on files and folders

Step 3 : Reboot the machine

Let us see the steps in Details :

Optional : command shell, type following command to mount root file system RW mode ( this is needed in case file permission denied error occurs while applying uid and gids permission ).

# mount -o remount,rw /

Step 1 : Run the commands to revert back  uids and gids on files and directories

# for u in 4(rpm -qa); do rpm –setugids $u;  done

Step 2 : Run the command to revert back permissions on files and folders

# for p in $(rpm -qa); do rpm –setperms $p;  done

Step 3 : Reboot the machine

#reboot

 

Both comments and pings are currently closed.

One Response to “Restore Linux file Permission”

  1. limerick says:

    It’s a pity you don’t have a donate button! I’d most certainly donate
    to this superb blog! I guess for now i’ll settle for bookmarking and adding your RSS feed to my Google account.
    I look forward to new updates and will talk about this blog with my Facebook group.

    Talk soon!

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk