#!/bin/bash
# This finds mounts which are supposed to be nosuid but aren't actually and remounts them
# https://stash.endurance.com/projects/HGSA/repos/eig-nosuid-remount/

for bindmount in $(awk '$4~/bind/&&$4~/nosuid/{print $2}' /etc/mtab);do 
       if [[ $(awk '$2=="'${bindmount}'"&&$4!~/nosuid/' /proc/mounts) ]]; then
               /bin/mount -o remount,nosuid ${bindmount};
       fi;
done
