How to restore standard default permissions on /etc?

Hello HP Admins,

Somehow Permissions of files inside /etc set to 777 in HP-UX 11. Due to this, system malfunctioning. I would like to know if there exists any command/script that sets all system files (or /etc atleast) to its default standard permissions.

I just don't want to run 755 on /etc as few files need special permissions (with "r" only to root etc.)

Thanks!

minus a better alternative ...

your best bet is to restore the directory from backups as some files in /etc are actually setuid/setgid -- according to my experience a while back -- and a plain chmod 755 will not be sufficient ... good luck!

You can restore some permissions from the package DB:

find /var/adm/sw/products -type f -name INFO | xargs awk '
$1=="path" && $2~/^\/etc\// {s=10; path=$2}
s==0 {next}
($1=="file" || --s==0) {s=0; if (mode!="") print "chmod",mode,path; mode=""; next}
$1=="mode" {mode=$2}
END {if (mode!="") print "chmod",mode,path}
'

Pipe this to /bin/sh in order to execute it.

Comparing to a different system is also a good option.