find /home -type d -perm 0766
That's a cool solution. We can have some more modifications.
The above one will find out the directories with permissions exactly match 0766
We need to find out the permissions like
0722, 0755, 0466, 0422, 0477, 0266, 0222, 0277, 0166, 0122, 0177, 071.... Oops!! the list is too long.
First we will generate the list of the permissions to be checked.
Code:
# I generated all the 3 digit numbers and prefixed a 0 using the following script
for ((a=100; a <= 777 ; a++)) ;do echo "0$a">>all ;done;
# Then removed the impossible permissions.
cat all |grep -v [89] >perm
# Now sorted out the files ending with permissions 2,3,5,6,7 (which allow others to write)
cat perm | grep [23567]$ >other_write
# Now I got the files with permissions that I want to check. So I start the check as follows
# I use one echo find /home -type d -perm $i so that I can get an idea that which permission is currently checked
for i in `cat other_write`; do echo find /home -type d -perm $i ; find /home -type d -perm $i ;done
# Now we can remove the temporary files
rm -rf all perm
# I keep other_write for future use
# In future I can run only for i in `cat other_write`; do find /home -type d -perm $i ;done
Now it works fine. :-)