caps lock caps lock - 27 days ago 14
Linux Question

check owners of run control scripts

To secure my computer I want to be sure that only "root", "sys", "bin" are owners of run control scripts..

This is what I get so far :

find -L /etc/rc* -ls | awk '$5 !="root" { print $0 }'


is there a better way to achieve this ?
thanks

Answer

To find all files not owned by root use:

find -L /etc/rc* ! -user root

To check for all three user names named in the question use:

find -L /etc/rc* ! -user sys -a ! -user sys -a ! -user bin