about summary refs log tree commit diff stats
path: root/bin/rmuser
blob: b7f5932026333e78cbdc3c398b7a00c0895500c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

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"

chflags nouappnd "/home/$1/.history"
chflags nouappnd "/home/$1/.bash_history"

set -e

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'