function f_suid { echo "[$SCRIPT_COUNT] Remove suid bits" if ! [ -f ./misc/suid.list ]; then echo "The list with SUID binaries can't be found." else while read -r suid; do file=$(command -v "$suid") if [ -x "$file" ]; then if stat -c "%A" "$file" | grep -qi 's'; then if [[ $VERBOSE == "Y" ]]; then echo "$file" fi fi chmod -s "$file" oct=$(stat -c "%A" "$file" | sed 's/s/x/g') ug=$(stat -c "%U %G" "$file") dpkg-statoverride --remove "$file" 2> /dev/null dpkg-statoverride --add "$ug" "$oct" "$file" 2> /dev/null fi done <<< "$(grep -E '^[a-zA-Z0-9]' ./misc/suid.list)" fi while read -r suidshells; do if [ -x "$suidshells" ]; then chmod -s "$suidshells" if [[ $VERBOSE == "Y" ]]; then echo "$suidshells" fi fi done <<< "$(grep -v '^#' /etc/shells)" ((SCRIPT_COUNT++)) }