Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- touch FWOA_tmp.txt
- echo "Wpisz swojego maila:"
- read usermail
- if [ "$#" -ne 0 ];then
- case $1 in
- -u | --user )
- oIFS=$IFS
- IFS=","
- users=$2
- IFS=$oIFS
- for user in $users
- do
- echo "######################$user#####################" >> FWOA_tmp.txt
- find / -type f -user "$user" -perm /333 2>/dev/null >> FWOA_tmp.txt
- done
- echo "THIS IS FILE ACCESS RAPORT FROM $(date)" | mail -s "FILE ACCESS $(hostname) FROM $(date)" "$usermail" < ~/Dokumenty/FWOA_tmp.txt
- ;;
- -g | --group )
- oIFS=$IFS
- IFS=","
- groups=$2
- IFS=$oIFS
- for group in $groups
- do
- echo "######################$group#####################" >> FWOA_tmp.txt
- find / -type f -group "$group" -perm /333 2>/dev/null >> FWOA_tmp.txt
- done
- echo "THIS IS FILE ACCESS RAPORT FROM $(date)" | mail -s "FILE ACCESS $(hostname) FROM $(date)" "$usermail" < ~/Dokumenty/FWOA_tmp.txt
- ;;
- -h | --help )
- echo "to jest pomoc"
- exit
- ;;
- esac
- fi
- users="$(awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd)"
- echo "$users"
- for user in $users
- do
- echo "######################$user#####################" >> FWOA_tmp.txt
- find / -type f -user "$user" -perm /333 2>/dev/null >> FWOA_tmp.txt
- done
- echo "THIS IS FILE ACCESS RAPORT FROM $(date) " | mail -s "FILE ACCESS $(whoami) FROM $(date)" "$usermail" < ~/Dokumenty/FWOA_tmp.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement