This is in AIX 5.3..I need to revert back permissions

Mistakebly I have changed the permissions on OS

I was in a folder /obie
ls -al
drwxr-x--x    obie:obi .
drwxr-x--x    obie:obi ..

In a rush I have changed the ownership of ". ."
chown -R root:system ..

This changed the whole OS permeissions to root:system

Please post all the steps as how to revert back changes
aixtutorialAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
@sjm_ee
Test like this
ls -l /usr/bin/ls
chown root.system /usr/bin/ls
ls -l /usr/bin/ls
sysck -Ni -f /etc/security/sysck.cfg  bos.rte.commands 2>/dev/null
ls -l /usr/bin/ls
-r-xr-xr-x    1 bin      bin           27468 Jun 22 2009  /usr/bin/ls
-r-xr-xr-x    1 root     system        27468 Jun 22 2009  /usr/bin/ls
-r-xr-xr-x    1 root     system        27468 Jun 22 2009  /usr/bin/ls
There are some 2200 entries in sysck.cfg, but only ca. 1000 with owner/group other than "root/system".
Only these are relevant to aixtutorial.
So I should have written "will do the trick only partially".
wmp
 
0
 
sjm_eeCommented:
There is no "undo" for chown or chmod. AIX does have some information about the AIX files in the system. You can use it as follows:

lslpp -Lc | grep -v "^#" | cut -d: -f1 | while read FILESET
do
sysck -iN -f /etc/security/sysck.cfg  "$FILESET"
done
0
 
woolmilkporcCommented:
Hi,

I'm not sure whether sysck will actually do the trick.

I assume you do have another AIX system at the same or a similar oslevel?

If so, and if sysck doesn't help, you could extract all the permissions from the unmodified system and apply them to the damaged system.

If you consider this an option, log in to the clean, unmodified system as root and run

find / -ls | awk '{print  "chown", $5 ":" $6, $11}' > chown_all.sh

Transfer the resulting file "chown_all.sh" to the damaged system, store it in a convenient location (maybe /tmp) and run as root

sh /tmp/chown_all.sh

There will be most probably lots of error messages complaining about files not found, which you'll have to ignore.
And of course this method can only work for files present on both systems, so you'll have no luck with filesystems (e.g. contained in user volume groups) unique to the damaged system.


Another idea - dou you have an mksysb image of the damaged system, taken before the ownership changes occurred?

If so, you could use the "-Po" (or "-PA") options of "restore", which will bring back the ownership (or all the attributes) of the files, without restoring the file contents.

Maybe you even do have "savevg" images of your non-rootvg volume groups? If so, you can also restore the ownership of files from those VGs.

If this could be an option, please let me know if you need assistance.

wmp
0
 
woolmilkporcCommented:
What I forgot to say -

the above "chown from clean system" method will not work for all the entries in /dev.

For those entries you must run additionally at the unmodified system

find /dev -ls | awk '{print  "chown", $5 ":" $6, $12}'  > chown_dev.sh

Transfer the new file to the damaged system and run it there, as described above.

Again, there will be "file not found" or usage errors (lots of). Ignore them!

wmp




0
 
sjm_eeCommented:
wmp: I'm not sure whether sysck will actually do the trick.

@wmp: We both agree that there is no *guaranteed" way out of this except full restore from backup. But sysck will get quite a lot back. Test like this:

# cat /tmp/test.sysck
ls -l /usr/bin/getconf
chown root.system /usr/bin/getconf
ls -l /usr/bin/getconf
sysck -Ni -f /etc/security/sysck.cfg  bos.net 2>/dev/null
ls -l /usr/bin/getconf
# . /tmp/test.sysck
-r-sr-xr-x   1 root     bin           23430 10 Jul 2005  /usr/bin/getconf
-r-sr-xr-x   1 root     system        23430 10 Jul 2005  /usr/bin/getconf
-r-sr-xr-x   1 root     bin           23430 10 Jul 2005  /usr/bin/getconf
#
0
All Courses

From novice to tech pro — start learning today.