brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: find -perm -4000 lists SUID programs, a security audit that takes one line

Security
~/tips/tip-security-find-suid-binaries-audit

sudo find / -xdev -type f -perm -4000 2>/dev/null | sort > suid-today.txt

Lists files that run with their owner's privileges so unexpected ones stand out.

Programs with the setuid bit run with their owner’s rights, usually root. I like to know exactly which ones exist.

sudo find / -xdev -type f -perm -4000 2>/dev/null | sort > suid-today.txt
diff suid-baseline.txt suid-today.txt

-perm -4000 matches files with the setuid bit set, and -xdev keeps find on one filesystem, so run it again for each mounted one such as /home. Use -perm -2000 for setgid files.

A fresh install has a short, known list, for example sudo, passwd and mount. Save it once as a baseline and compare later, and a new entry in /tmp or a home directory deserves a closer look.

Further reading: find manual page

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link