forked from dannyti/seedbox-from-scratch
-
Notifications
You must be signed in to change notification settings - Fork 4
/
deleteSeedboxUser
executable file
·48 lines (34 loc) · 892 Bytes
/
deleteSeedboxUser
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Hellish Tech
# No commercial usage without authorization
exec 1> >(logger -s -t $(basename $0)) 2>&1
NEWUSER1=a
NEWUSER2=b
while [ ! $NEWUSER1 = $NEWUSER2 ];
do
clear
echo -n "Type username to be DELETED: "
read NEWUSER1
echo -n "Retype username: "
read NEWUSER2
echo ""
done
# 3.1.1
#kill all processes related to that user
sudo kill -9 $( sudo ps -ef | grep $NEWUSER1 | awk '{ print $2 }' )
# 3.2
sudo userdel --remove --force $NEWUSER1
# 12.
#remove current password from htpassword
sudo perl -pi -e "s/^$NEWUSER1\:.*\n$//g" /etc/apache2/htpasswd
# 20.
############## sudo rm -r /home/downloads/$NEWUSER1
# 21.
sudo rm /etc/init/rtorrent.$NEWUSER1.conf
# 29.
sudo rm /etc/seedbox-from-scratch/users/$NEWUSER1.info
echo ""
echo "$NEWUSER1 has been deleted."
echo ""
##################### LAST LINE ###########
# scripts are now in git form :)