A script that allows admins of thunix to make user accounts easily.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/bin/bash
|
|
|
|
CONFIG=./setenv
|
|
|
|
|
|
|
|
. $CONFIG
|
|
|
|
|
|
|
|
source include/functions
|
|
|
|
|
|
|
|
if [ -z $1 ]
|
|
|
|
then
|
|
|
|
echo -e "Usage: `basename $0` username [ --banned ][ --backup ]"
|
|
|
|
else
|
|
|
|
echo "This will remove user account $1 from Thunix."
|
|
|
|
echo "It is assumed the user account has been un-enforced in Ansible as well."
|
|
|
|
|
|
|
|
echo "Killing user processes..."
|
|
|
|
sudo pkill -9 -U $1
|
|
|
|
|
|
|
|
if [ -n $2 ]
|
|
|
|
then
|
|
|
|
[ "$2" = "--backup" ] && backup_user_data $1
|
|
|
|
[ "$2" = "--banned" ] && echo $1 | sudo tee -a $BANNED
|
|
|
|
fi
|
|
|
|
|
|
|
|
remove_user $1
|
|
|
|
fi
|
|
|
|
|