Compare commits

..

1 Commits

Author SHA1 Message Date
Clemens Schwaighofer
e45b89c582 AWS Delete user, remove all secondary groups first.
To make sure tha on delete the user is removed from all secondary groups
unset them first before running the userdel command.

-r might not be enought to do that in some situations
2025-01-06 13:45:51 +09:00

View File

@@ -164,9 +164,13 @@ for username in "$@"; do
echo "[1] Remove user + home dir";
if [ ${TEST} -eq 0 ]; then
userdel -r "${username}"
# remove all secondary group entries first before we delete the user
# there might be cases where they are left
usermod -G "" "${username}";
userdel -r "${username}";
else
echo "$> userdel -r ${username}";
echo "$> usermod -G \"\" \"${username}\"";
echo "$> userdel -r \"${username}\"";
fi;
# remove ssh files in pub