diff --git a/deathwatch.sh b/deathwatch.sh index 8d9755c..426e0c2 100755 --- a/deathwatch.sh +++ b/deathwatch.sh @@ -3,7 +3,7 @@ # efficiently checks each user directory to see if the .ssh folder has been deleted # deletes the user if it has -inotifywait -mrqe delete users | while read -r dir +inotifywait -mre delete users | while read -r dir do echo "$dir" | grep -q 'ISDIR .ssh' \ && ./deluser.sh "$(echo "$dir" | cut -f 2 -d '/')" diff --git a/deluser.sh b/deluser.sh index c3ebc0a..f041ccb 100755 --- a/deluser.sh +++ b/deluser.sh @@ -11,15 +11,15 @@ then exit fi -if ps -o stat= -p $PPID | grep -qv S+ #check if this is being called from listen.py +if ps -o stat= -p $PPID | grep -qv S+ #check if this is being called from deathwatch.sh then echo "YOU ARE ABOUT TO PERMANENTLY DELETE USER $SLBRUSER AND ALL OF THEIR DATA. RE-ENTER THE USER'S NAME TO CONTINUE" read -r ENTEREDUSER [ "$ENTEREDUSER" != "$SLBRUSER" ] && echo "users did not match, exiting..." && exit fi -lxc stop "$SLBRUSER" -lxc delete "$SLBRUSER" -sudo rm -rf "/home/slbr/users/$SLBRUSER" -sudo userdel "$SLBRUSER" -sed -i "s/^$SLBRUSER$//g" users.txt +lxc stop --force "$SLBRUSER" +lxc delete --force "$SLBRUSER" +sudo rm -rf "/home/slbr/users/$SLBRUSER" +sudo userdel -f "$SLBRUSER" +sed -i "s/^$SLBRUSER$//g" users.txt sed -i '/^$/d' users.txt diff --git a/login.sh b/login.sh index f178c43..66ed2f4 100755 --- a/login.sh +++ b/login.sh @@ -7,7 +7,7 @@ . /etc/profile.d/apps-bin-path.sh SLBRUSER="$(whoami)" -lxc list | grep -q "$(echo "$SSH_CLIENT" | cut -f 1 -d ' ')" && ~/killme.sh && exit +lxc list | grep -q "$(echo "$SSH_CLIENT" | cut -f 1 -d ' ')" && ~/killme.sh && exit 0 echo "The game has not started yet! Grab a cup of tea, or just wait here." while test -z "$(cat /home/slbr/gamestatus)" || break do diff --git a/suicidebash.bashrc b/suicidebash.bashrc index 064b4de..74ca4db 100644 --- a/suicidebash.bashrc +++ b/suicidebash.bashrc @@ -55,7 +55,7 @@ fi suicidePostCommand() { if [ $? -ne 0 ]; then - ssh -o "StrictHostKeyChecking no" testuser@10.123.168.1 & + ssh -o "StrictHostKeyChecking no" "$(hostname)@10.123.168.1" "exit 0" & echo "$(tput setaf 3)====$(tput setaf 1)$(tput bold)YOU HAVE BEEN ELIMINATED$(tput sgr0)$(tput setaf 3)====$(tput sgr0)" sleep 2 fi diff --git a/users.txt b/users.txt index e69de29..4db90f4 100644 --- a/users.txt +++ b/users.txt @@ -0,0 +1 @@ +testuser