?
Solved

Fixmog equivalent for Linux

Posted on 2011-05-12
3
Medium Priority
?
445 Views
Last Modified: 2012-08-14
Hi,

I’m working under Linux ReHat entreprise V5

I made a mistake and I changed erroneously all the permissions for the operating system

# cd /
# chmod –R 777 *

I known that Unix SCO have a command called fixmog for fix the permissions of the operating system. Do you know if there is something similar in Linux?

Thanks for your help,
0
Comment
Question by:alcani
3 Comments
 
LVL 8

Expert Comment

by:Rance_Hall
ID: 35748973
Ouch:

Sorry about this.  But on the bright side you did not do a "rm -rf /"

The rpm package management system in Red Hat has some builtin tools that should help you out.

rpm --setperms <packagename>
rpm --setugids <packagename>

You have to do this one package at a time, but these rpm commands will check the files installed with the files from the rpm and if needed fix the permissions and user/group assignments.

You probably want to write a script that asks the rpm database for each package installed and for each one run these two commands.

This will not give you a 100% fix though.  Any file that was supposed to be installed by an rpm update and was given a new name so as not to mess with an existing file might not be caught by this approach because the new name is not actually part of the package inventory.

If you need help with the script let me know, but this should get you what you want.

Rance
0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 1000 total points
ID: 35750332
As root
for Package in `rpm -qa`; do rpm --setperms $Package; done
0
 
LVL 10

Assisted Solution

by:dfke
dfke earned 1000 total points
ID: 35752660
To fix the permissions enter:

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

To fix the group assignments:

for p in $(rpm -qa); do rpm --setugids $p; done
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month15 days, 3 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question