makeuser/rmuser

16 lines
496 B
Plaintext
Raw Normal View History

#!/bin/bash
2019-05-14 11:36:41 +00:00
echo "This will remove user account $1 from Thunix."
echo "It is assumed the user account has been un-enforced in Ansible as well."
2019-05-14 11:36:41 +00:00
echo "Killing user processes..."
sudo pkill -9 -U $1
2019-06-15 16:48:37 +00:00
echo "Archiving home dir..."
sudo tar cfz /root/backups/$1.tgz /home/$1
2019-06-15 16:48:37 +00:00
sudo rm -rf /home/$1
2019-05-14 11:36:41 +00:00
echo "Deleting account from system..."
sudo userdel $1
2019-05-14 11:36:41 +00:00
2019-06-15 16:48:37 +00:00
echo "User $1 removed from system. Make sure user is unenforced in ansible." | sudo mail -s "User Account $1 removed from Thunix" root@thunix.net