From 1a7a8e6d5d50b2f53ea7e0b76dfbf7949ed45147 Mon Sep 17 00:00:00 2001 From: Patrick Marchand Date: Wed, 14 Nov 2018 15:43:45 -0500 Subject: [PATCH] Inverse userdel(1) calls in scripts/web-add.sh When a user has the same name as his primary group, userdel(1) tries to remove it as well, but stops and prints an error message if that group is being used by any other users as their primary group. By deleting the www user first, the group is properly deleted. This means we can get rid of the subsequent call to groupdel(1). Tested by adding / removing a vhost on my testing vm. --- scripts/web-add.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/web-add.sh b/scripts/web-add.sh index 10444a3..a7d0c0f 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -592,14 +592,13 @@ op_del() { read -r set -x - userdel "$login" if [ "$WEB_SERVER" == "apache" ]; then userdel www-"$login" fi - groupdel "$login" + userdel "$login" for php_version in "${PHP_VERSIONS[@]}"; do - lxc-attach -n php"${php_version}" -- userdel -f "$login" lxc-attach -n php"${php_version}" -- userdel -f www-"$login" + lxc-attach -n php"${php_version}" -- userdel -f "$login" done sed -i.bak "/^$login:/d" /etc/aliases if [ "$WEB_SERVER" == "apache" ]; then