1848556 Members
6581 Online
104033 Solutions
New Discussion

World Wriable Files

 
SOLVED
Go to solution
David Bellamy
Respected Contributor

World Wriable Files

Hello Gurus

Does anyone have a script that can locate world writable files on a UNIX system
4 REPLIES 4
Marvin Strong
Honored Contributor

Re: World Wriable Files

no need for a script you can just use find.

this should do it.

find /path -perm -o+w

James R. Ferguson
Acclaimed Contributor

Re: World Wriable Files

Hi David:

How about a simple command?

# find /path -xdev -type f -perm -o+w

...If you really want to search the entire server, crossing all mountpoints, drop the '-xdev' argument and do:

# find / -type f -perm -o+w

Regards!

...JRF...
DCE
Honored Contributor
Solution

Re: World Wriable Files


David

This should work:




# Define a spot for the output file
FileOut=/var/adm/world_writable_files.log
DirOut=/var/adm/world_writable_directories.log

#
# Zero out each log file and date stamp it
#
DATE=`date '+%Y-%m-%d'`
echo "# $DATE **World Writeable Files**" > $FileOut
echo "# $DATE **World Writeable Directories**" > $DirOut
#
# Generate a list of filesystems to search. Only search local filesystems
#
FSList=`df --no-sync -l |awk '/dev/{print $6}'`

for f in ${=FSList}; do
find ${f} -type f -xdev -perm -0002 >> $FileOut
find ${f} -type d -xdev -perm -0002 >> $DirOut
done
David Bellamy
Respected Contributor

Re: World Wriable Files

Thanks all, just what i was looking for :)