Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
I need this script badly, could anyone please help me out for it? I tried toooo hard to write this but I don't find any proper solution for it.
Description:
To find world writable directories from one directory on network and log those directory names with full path to one log file.I know there are some directories those are world-writable and need not to be logged in this log.
Following is more explanation:
Dir1 (this is the directory from where i want to find world writable directories)
Dir1.1
Dir1.2
Dir1.3
Dir1.4
Dir1.5I know Dir1.2 is world-writable directory but about other directories I don't know. Now I need a script which finds world writable diretories from Dir1 and log the names of them in to Test.log but this list should not contain Dir1.2 (As I know it is world writable directory)
And at last, this script should send a mail to abc@def.com
Thanks in advance.Regards,
Ketan

Hi,
I tried with
find /dir1 -name -type d -print -perm -o+w >> /tmp/writabledirs.log
THEN..
grep "dir1.2" writabledirs.log | while read line ;
do
#echo "$line"
if "$line" == "/dir1/dir1.2"
else
grep "$line" -v writabledirs.log > newwritabledirs.log
doneThis do...done is to search dir1.2 and not log that directory name in another log.
Also I tried with:
find /dir1 -type d -print -perm 777 >> /tmp/writabledirs.log
mail -s "World Writable Directory(ies) found..." abc@def.com root < /tmp/writabledirs.logThen I tried with:
find /dir1 \( -local -o -prune \) -perm -2 \!
\( -type d \) -ls >> /tmp/writabledirs.log
mail -s "World Writable Directory(ies) found..." abc@def.com root < /tmp/writabledirs.log
But any of them does not work, it shows all the directories with any permission!! Could you please help me to find proper solution ASAP?Thanks in advance.
Regards,
Ketan

Please help me to write such script. I am badly requires this script.
Thanks in advance.
Regards,
Ketan

Try this example and then add your "-path DIR -prune -o" sequence or if you are only interested in a top level directory use "-maxdepth 1" so that it doesn't travel down into sub-directories like Dir1.2 or Dir1.3.
find / -noleaf -path /proc -prune -o -path /export -prune -o -perm -002 \( -type f \) -ls
OR
find . -maxdepth 1 -perm -002 \( -type f \) -ls

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |