How to restore default system permissions on Red Hat, CentOs, Fedora
While I start my OS it does not shows any login screen.
The rpm has a
parameter called –setperms and –setugids. Using this we can recover our Operating System
- Boot/reboot machine
- At blue RedHat screen press any key to enter the boot loader
- Press ‘e’ to edit the most recent boot command
- Use the arrow keys to select the line that starts with “kernel”
- Press ‘e’ to edit the kernel command
- Append ‘S’ to the end of the line. There should be a space before
the previous end of the line (probably ‘quiet’) and the ‘S’.
- Hit Enter to commit the change
- Hit ‘b’ to boot
Enter this in the root prompt.
1) To reset uids and gids on files and directories
for u in $(rpm -qa); do rpm –setugids $u; done
2) To permissions on files and directories
for p in $(rpm -qa); do rpm –setperms $p; done