From bc0089f61e71f06e9b7b31dcb378d4bd40f5d916 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 19 Jun 2020 14:01:18 +0100 Subject: [PATCH] Remove user account --- deploy/i2p | 13 +++++++------ deploy/onion | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/deploy/i2p b/deploy/i2p index efcf6f83..ce441983 100755 --- a/deploy/i2p +++ b/deploy/i2p @@ -15,8 +15,8 @@ if [[ "$1" == 'remove' ]]; then rm /var/lib/i2pd/epicyon.dat systemctl restart i2pd - systemctl stop "${username}" - systemctl disable "${username}" + systemctl stop "${username}.service" + systemctl disable "${username}.service" rm "/etc/nginx/sites-enabled/${username}" rm "/etc/nginx/sites-availale/${username}" rm -rf ${install_destination} @@ -26,6 +26,7 @@ if [[ "$1" == 'remove' ]]; then if [ -d /srv/http/cache ]; then rm -rf /srv/http/cache fi + userdel -r ${username} echo 'Epicyon i2p instance removed' exit 0 fi @@ -80,8 +81,8 @@ fi echo 'Adding an epicyon system user account' if [ -f /usr/bin/pacman ]; then - groupadd epicyon - useradd --system -g epicyon --home-dir=${install_destination} $username + groupadd ${username} + useradd --system -g ${username} --home-dir=${install_destination} $username groupadd www-data useradd --system -g www-data --home-dir=/srv/http www-data else @@ -214,8 +215,8 @@ echo 'Creating Epicyon daemon' echo 'WantedBy=multi-user.target'; } > "/etc/systemd/system/${username}.service" systemctl daemon-reload -systemctl enable "/etc/systemd/system/${username}.service" -systemctl restart "/etc/systemd/system/${username}.service" +systemctl enable "${username}.service" +systemctl restart "${username}.service" echo 'Creating nginx configuration' if [ ! -f /etc/nginx/nginx.conf ]; then diff --git a/deploy/onion b/deploy/onion index 93c97167..b7804909 100755 --- a/deploy/onion +++ b/deploy/onion @@ -10,8 +10,8 @@ if [[ "$1" == 'remove' ]]; then rm -rf /var/lib/tor/hidden_service_epicyon systemctl restart tor - systemctl stop "${username}" - systemctl disable "${username}" + systemctl stop "${username}.service" + systemctl disable "${username}.service" rm "/etc/nginx/sites-enabled/${username}" rm "/etc/nginx/sites-availale/${username}" rm -rf ${install_destination} @@ -21,6 +21,7 @@ if [[ "$1" == 'remove' ]]; then if [ -d /srv/http/cache ]; then rm -rf /srv/http/cache fi + userdel -r ${username} echo 'Epicyon onion instance removed' exit 0 fi @@ -61,8 +62,8 @@ fi echo 'Adding an epicyon system user account' if [ -f /usr/bin/pacman ]; then - groupadd epicyon - useradd --system -g epicyon --home-dir=${install_destination} $username + groupadd ${username} + useradd --system -g ${username} --home-dir=${install_destination} $username groupadd www-data useradd --system -g www-data --home-dir=/srv/http www-data else @@ -127,8 +128,8 @@ echo 'Creating Epicyon daemon' echo 'WantedBy=multi-user.target'; } > "/etc/systemd/system/${username}.service" systemctl daemon-reload -systemctl enable ${username} -systemctl restart ${username} +systemctl enable "${username}.service" +systemctl restart "${username}.service" echo 'Creating nginx configuration' if [ ! -f /etc/nginx/nginx.conf ]; then