From: jparker@hpbs3645.boi.hp.com (Jack Parker) Newsgroups: comp.databases.informix Subject: correcting permission on Informix Date: 17 Apr 1995 12:48:04 -0400 X-Informix-List-ID: > As it is known, in the directory with the Informix's program files, there is > a necessity that some of these files must have particular rights and/or owner, > group, etc... > > If the permissions or the ownership of these particular files change for one > reason or another, the system stops being operational. > > Is there any method which enables us to restore the correct permissions and/or > ownership of these special files, if by mistake there is a change on them, Yes, just fix them (chmod). The enclosed script will print out any files which are set incorrectly for any informix product. Ciao Andrea, --- cut here ---- ############################################################################## # Check the informix file distribution list against actual files to verify # that all have the correct ownerships and permissions. # Syntax is: ckfls $filename # where $filename is the filelist to check (e.g. onlinefiles, netfiles, # sqlfiles) # Jack Parker 4/93 # ############################################################################## ############################################################################## # modify the -rwxr-x--- string into a 4 digit permission figure. ############################################################################## ck_pm() { act_pm=`echo $af | awk '{ b1=substr($1,1,1) b2=substr($1,2,1) b3=substr($1,3,1) b4=substr($1,4,1) b5=substr($1,5,1) b6=substr($1,6,1) b7=substr($1,7,1) b8=substr($1,8,1) b9=substr($1,9,1) b0=substr($1,10,1) op=0 gp=0 xp=0 sp=0 if (b2=="r") {op+=4} if (b3=="w") {op+=2} if (b4=="x") {op+=1} if (b4=="s" || b4=="S") {sp+=4 op+=1} if (b5=="r") {gp+=4} if (b6=="w") {gp+=2} if (b7=="x") {gp+=1} if (b7=="s"|| b7=="S") {sp+=2 gp+=1} if (b8=="r") {xp+=4} if (b9=="w") {xp+=2} if (b0=="x") {xp+=1} if (b0=="t"||b0=="T") {sp+=1 xp+=1} printf("%1d%1d%1d%1d\n", sp, op, gp, xp) }'` } ############################################################################## # main loop ############################################################################## # lose the comments grep -v "^#" /usr/informix/etc/$1 | while read line do # don't process null lines if [ -n "$line" ] then # get the file name fnm=`echo $line | cut -d" " -f1` # we still will get a line called 'PRODUCT' lose it if [ $fnm != "PRODUCT" ] then # get owners, group, and permission number own=`echo $line | cut -d" " -f2` grp=`echo $line | cut -d" " -f3` mod=`echo $line | cut -d" " -f4` # ls -l the file af=`ls -l -d $INFORMIXDIR/$fnm` # don't check it if the file is missing if [ $? -eq 0 ] then # develop a 4 digit permission to compare ck_pm # get actual owner and group act_own=`echo $af | cut -d" " -f3` act_grp=`echo $af | cut -d" " -f4` # are they the same? if [ $act_own != $own -o $act_grp != $grp -o $act_pm -ne $mod ] then echo "\nMismatch - Actual :\n$af\nCorrect :\n$INFORMIXDIR/$line\n" fi fi fi fi done --- and here --- _____________________________________________________________________________ Jack Parker - Hewlett Packard, BSMC Boise, Idaho, USA jparker@hpbs3645.boi.hp.com _____________________________________________________________________________ "A thing is bigger for being shared" - Gaelic _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________