find / -xdev -type f -perm -4000 -ls

Category: Security & Hardening

find / -xdev -type f -perm -4000 -ls

Find all setuid binaries

Lists every file with the setuid bit set, which makes it run with the owner's privileges, a classic privilege-escalation vector. The -xdev flag keeps the search on one filesystem. Review the list and remove setuid from anything that does not need it with chmod u-s.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.