Operating System - HP-UX
1833868 Members
1936 Online
110063 Solutions
New Discussion

reset owner of system files

 
SOLVED
Go to solution
WENCHE LISE HALVORSEN
Occasional Contributor

reset owner of system files

A dba had an accident: did a chown -R ora920 * from /. To get the server running we have done the same again like chown -R root * from /. Does anybody have an idea how to resolve this problem? (get all system files ower correct).

We do have a similar system where we may check what the correct ownership should be.

Espen
4 REPLIES 4
Mark Grant
Honored Contributor

Re: reset owner of system files

Somebody will have a better solution than this but here goes. Take the attached program (mgstat.c), compile it with "cc -o mgstat mgstat.c". Make sure the resulting binary is in your PATH on the OK server then do this.

find / -xdev -print -exec mgstat -o name {} \; > /filelist

This will create a file (/filelist) that should contain every file and the owner. Then copy this file to your other server and do.

cat filelist | perl -n -e "$name=$_;$file=<>;`chown $name $file`;"

I would test this with a simple filelist first if I were you. IT works for me though.
Never preceed any demonstration with anything more predictive than "watch this"
Artyom Voronchihin
Respected Contributor

Re: reset owner of system files

It was not good idea to give root access to dba. All oracle operations should make with oracle:dba user. Now it will be difficult to restore correct ownership for all files. For /dev you can remove all pseudo drivers from there and recreate them with insf -e. (don't forget to make backup copy before removing) For oracle folders owner used to be oracle:dba. For user's home folders owners can be checked in /etc/passwd. For other files and folders ownership used to be root:sys or bin:bin, see it on the similar system.
"Intel inside" is not a label, it's a warning.
Graham Cameron_1
Honored Contributor
Solution

Re: reset owner of system files

Similar to Mark's, but without using C or Perl:
On the "good" system:
--
find / -type f -exec ls -ld {} \; 2>/dev/null|awk '{printf ("chown %s:%s %s\n", $3, $4, $NF)}' >/tmp/fixperms.sh
--
ftp /tmp/fixperms.sh to the bad system, and run it as root.
--
Then take away root access from your DBA.
In fact do that first.
He doesn't need it.
I am a DBA (ex unix admin) and haven't had a root password for years...
-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Jakes Louw
Trusted Contributor

Re: reset owner of system files

Have a look at SWVERIFY as a way of at least getting the standard HP-UX files back to normal. There is a "fix" option that will return file and directory attributes to what they should be.
Trying is the first step to failure - Homer Simpson