Wednesday, September 06, 2006

Fun with 'find'

find . -printf 'Name: %f Owner: %u %s bytes\n'

From: http://marcnapoli.com.au/osi.php

find files younger than 24h

find . -type f -mtime -0

find dirs younger than 60 minutes

find . -type d -mmin -60

find all SUID and SGID

find / -path '/proc' -prune -o -path '/www/db/' -prune -o -type f -perm +6000 -fls /root/findallsetuidgid.txt

find / -xdev -type f -perm +u=s -o -perm +g=s -print

find all world writables on a system

find / -noleaf -path '/proc' -prune \

-o -path '/sys' -prune \

-o -path '/dev' -prune \

-o -perm -2 ! -type l ! -type s \

! \( -type d -perm -1000 \) -fls /root/findworldwritables.txt

## Search / skipping a few dirs. noleaf assumes not all mounted
filesystems are unix fs. It will skip sockets, symlinks, and any
directory with the sticky bit set.



find all files owned by no one in particular

find / -path '/proc' -prune -o -nouser -o -nogroup -fls /root/findownedbynoone.txt

No comments: