cyber-patriot/dostuff.sh

28 lines
408 B
Bash
Executable File

#!/bin/bash
function getextras {
diff - "$1" |
grep '>' - |
cut -b 3-
}
sort users.txt > usrtmp
mv usrtmp users.txt
ls /home |
sort |
getextras users.txt |
while read name; do
echo deluser $name
done
sort admins.txt > admtmp
mv admtmp admins.txt
grep 'adm' /etc/group |
cut -f 4 -d ':' |
tr ',' '\n' |
sort |
getextras admins.txt
echo sudo ufw enable