hello,
I need to check if files +rx by user or at least by members of group user belongs to or by other world.
I have created list of files with complete 4096 permission possibilities.
How to pass all groups user is member of (marked in red) to the last awk command using variable?
Code:
# chown root .;chmod 700 .
# [blue][bold]ls file????|wc[/blue][/bold]
4096 4096 36864
# [blue][bold]ls -al file????|awk '$1$2~/^-r.x......nobody$/||$1$4~/^-...r.x...system$/||$1~/^-......r.x$/'|tail -5[/blue][/bold]
-rwsr-srwx 1 root system 0 Dec 06 14:39 file6757
-rwsrwSr-x 1 root system 0 Dec 06 14:39 file6765
-rwsrwSrwx 1 root system 0 Dec 06 14:39 file6767
-rwsrwsr-x 1 root system 0 Dec 06 14:39 file6775
-rwsrwsrwx 1 root system 0 Dec 06 14:39 file6777
# [blue][bold]ls -al file????|awk '$1$2~/^-r.x......nobody$/||$1$4~/^-...r.x...system$/||$1~/^-......r.x$/'|wc -l[/blue][/bold]
960
# [blue][bold]chgrp cron file5777[/blue]
#
# [blue][bold]ls -al file????|awk '$1$2~/^-r.x......nobody$/||$1$4~/^-...r.x...system$/||$1~/^-......r.x$/'|wc -l[/blue][/bold]
959
# [blue][bold]lsuser -a groups root|awk -F= '{print $NF}'|sed s/,/\|/g[/blue][/bold]
[red]system|bin|sys|security|cron|audit|lp|idsldap|idsldag[/red]
# [blue][bold]ls -al file????|awk '$1$2~/^-r.x......nobody$/||$1$4~/^-...r.x...([/blue][red]system|bin|sys|security|cron|audit|lp|idsldap|idsldag[/red][blue])$/||$1~/^-......r.x$/'|wc -l[/blue][/bold]
960