This if my first attempt at bash scripting. I am trying to create a script to check on every single file owner and group starting under a certain directory.
For example if I have this:
files=/*
for f in $files; do
owner=$(stat -c %U $f)
if [ "$owner" != "someone" ]; then
echo $f $owner
fi
done
The ultimate goal is to fix permission problems. However, I am not able to get the /* variable to go underneath everything in /, it will only check the files under / and stop at any new directories. Any pointers on how I could check for permissions over everything under / and any of its sub-directories?
you can try this one, it is a recursive one:
Play a little with in a another directory before replacing playFiles “/root/” with : playFiles “/“. Btw playFiles is a bash function. Hopefully this will help you.