17 lines
438 B
Bash
17 lines
438 B
Bash
|
#!/bin/sh
|
||
|
#This should only be run by users who have been eliminated
|
||
|
SLBRUSER=$(whoami)
|
||
|
test -z "$SLBRUSER" && echo "no user provided" && exit
|
||
|
if !(grep -qE "^$SLBRUSER$" /home/slbr/users.txt)
|
||
|
then
|
||
|
echo "user not found in users.txt, will not delete"
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
rm -rf "/home/sblr/$SLBRUSER"
|
||
|
userdel "$SLBRUSER"
|
||
|
sed -i "s/^$SLBRUSER$//g" /home/slbr/users.txt
|
||
|
sed -i '/^$/d' /home/slbr/users.txt
|
||
|
lxc stop "$SLBRUSER"
|
||
|
lxc delete "$SLBRUSER"
|