Finding setuid and setgid files

setuid files when executed inherit the permissions of the owner of the file. So having files with setuid of root is a bad idea.

Here's how to find it and unset it.

Note:
There are some system files like at and crontab that have these bits set and is required for it to run.

# find / -perm +6000 -type f -exec ls -ld {}\; > setuid.txt &

To unset it:

# chmod a-s <file>

Comment