admin/bin/rmuser

18 lines
455 B
Bash
Executable File

#!/bin/sh
set -eu
if [ -z "$1" ]; then
printf 'Please pass a user as the first argument.\n'
exit 1
fi
printf 'Removing user %s from the system\n' "$1"
userdel -r -v "$1"
printf 'Cleaning /var/www/users/%s\n' "$1"
rm -rf "/var/www/users/$1"
printf 'Deleting cgit repos\n'
rm -rf "/var/www/cgit_repos/$1"
printf 'Removing httpd config\n'
rm -f "/etc/httpd/$1.conf"
printf 'You need to remove the include line from httpd-vusers.conf and restart httpd\n'