Remove user account

main
Bob Mottram 2020-06-19 14:01:18 +01:00
parent a58efc6e0a
commit bc0089f61e
2 changed files with 14 additions and 12 deletions
deploy

View File

@ -15,8 +15,8 @@ if [[ "$1" == 'remove' ]]; then
rm /var/lib/i2pd/epicyon.dat rm /var/lib/i2pd/epicyon.dat
systemctl restart i2pd systemctl restart i2pd
systemctl stop "${username}" systemctl stop "${username}.service"
systemctl disable "${username}" systemctl disable "${username}.service"
rm "/etc/nginx/sites-enabled/${username}" rm "/etc/nginx/sites-enabled/${username}"
rm "/etc/nginx/sites-availale/${username}" rm "/etc/nginx/sites-availale/${username}"
rm -rf ${install_destination} rm -rf ${install_destination}
@ -26,6 +26,7 @@ if [[ "$1" == 'remove' ]]; then
if [ -d /srv/http/cache ]; then if [ -d /srv/http/cache ]; then
rm -rf /srv/http/cache rm -rf /srv/http/cache
fi fi
userdel -r ${username}
echo 'Epicyon i2p instance removed' echo 'Epicyon i2p instance removed'
exit 0 exit 0
fi fi
@ -80,8 +81,8 @@ fi
echo 'Adding an epicyon system user account' echo 'Adding an epicyon system user account'
if [ -f /usr/bin/pacman ]; then if [ -f /usr/bin/pacman ]; then
groupadd epicyon groupadd ${username}
useradd --system -g epicyon --home-dir=${install_destination} $username useradd --system -g ${username} --home-dir=${install_destination} $username
groupadd www-data groupadd www-data
useradd --system -g www-data --home-dir=/srv/http www-data useradd --system -g www-data --home-dir=/srv/http www-data
else else
@ -214,8 +215,8 @@ echo 'Creating Epicyon daemon'
echo 'WantedBy=multi-user.target'; } > "/etc/systemd/system/${username}.service" echo 'WantedBy=multi-user.target'; } > "/etc/systemd/system/${username}.service"
systemctl daemon-reload systemctl daemon-reload
systemctl enable "/etc/systemd/system/${username}.service" systemctl enable "${username}.service"
systemctl restart "/etc/systemd/system/${username}.service" systemctl restart "${username}.service"
echo 'Creating nginx configuration' echo 'Creating nginx configuration'
if [ ! -f /etc/nginx/nginx.conf ]; then if [ ! -f /etc/nginx/nginx.conf ]; then

View File

@ -10,8 +10,8 @@ if [[ "$1" == 'remove' ]]; then
rm -rf /var/lib/tor/hidden_service_epicyon rm -rf /var/lib/tor/hidden_service_epicyon
systemctl restart tor systemctl restart tor
systemctl stop "${username}" systemctl stop "${username}.service"
systemctl disable "${username}" systemctl disable "${username}.service"
rm "/etc/nginx/sites-enabled/${username}" rm "/etc/nginx/sites-enabled/${username}"
rm "/etc/nginx/sites-availale/${username}" rm "/etc/nginx/sites-availale/${username}"
rm -rf ${install_destination} rm -rf ${install_destination}
@ -21,6 +21,7 @@ if [[ "$1" == 'remove' ]]; then
if [ -d /srv/http/cache ]; then if [ -d /srv/http/cache ]; then
rm -rf /srv/http/cache rm -rf /srv/http/cache
fi fi
userdel -r ${username}
echo 'Epicyon onion instance removed' echo 'Epicyon onion instance removed'
exit 0 exit 0
fi fi
@ -61,8 +62,8 @@ fi
echo 'Adding an epicyon system user account' echo 'Adding an epicyon system user account'
if [ -f /usr/bin/pacman ]; then if [ -f /usr/bin/pacman ]; then
groupadd epicyon groupadd ${username}
useradd --system -g epicyon --home-dir=${install_destination} $username useradd --system -g ${username} --home-dir=${install_destination} $username
groupadd www-data groupadd www-data
useradd --system -g www-data --home-dir=/srv/http www-data useradd --system -g www-data --home-dir=/srv/http www-data
else else
@ -127,8 +128,8 @@ echo 'Creating Epicyon daemon'
echo 'WantedBy=multi-user.target'; } > "/etc/systemd/system/${username}.service" echo 'WantedBy=multi-user.target'; } > "/etc/systemd/system/${username}.service"
systemctl daemon-reload systemctl daemon-reload
systemctl enable ${username} systemctl enable "${username}.service"
systemctl restart ${username} systemctl restart "${username}.service"
echo 'Creating nginx configuration' echo 'Creating nginx configuration'
if [ ! -f /etc/nginx/nginx.conf ]; then if [ ! -f /etc/nginx/nginx.conf ]; then