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

View File

@ -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

View File

@ -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