Shell script to find all programs and scripts with setuid bit set on

by on April 10, 2008 · 0 comments

  1. #!/bin/bash
  2. # Shell script to find all programs and scripts with setuid bit set on.
  3. # If your system ever cracked (aka hacked) then system has this kind of binary
  4. # installed; besides the normal setuuid scripts/programs
  5. #
  6. # *TIP*
  7. # User directory /home and webroots such as /www canbe mounted with
  8. # nosuid option.
  9. #
  10. # Copyright (c) 2005 nixCraft project.
  11. # This script is licensed under GNU GPL version 2.0 or above
  12. # For more info, please visit:
  13. # http://cyberciti.biz/shell_scripting/bmsinstall.php
  14. # -------------------------------------------------------------------------
  15. # This script is part of nixCraft shell script collection (NSSC)
  16. # Visit http://bash.cyberciti.biz/ for more information.
  17. # -------------------------------------------------------------------------
  18. #SPATH="/usr/local/etc/bashmonscripts"
  19. #INITBMS="$SPATH/defaults.conf"
  20. #[ ! -f $INITBMS ] && exit 1 || . $INITBMS
  21.  
  22. [ $# -eq 1 ] && : || die "Usage: $($BASENAME $0) directory" 1
  23.  
  24. DIRNAME="$1"
  25. $FIND $DIRNAME -xdev -type f -perm +u=s -print


4000+ howtos and counting! If you enjoyed this article, join 45000+ others and get free email updates!

Click here to subscribe via email.

Previous Script:

Next Script: