Skip empty group on login check

This commit is contained in:
Clemens Schwaighofer
2024-11-11 17:06:24 +09:00
parent d8cd628ddd
commit 4629b58a7e

View File

@@ -111,6 +111,10 @@ for ssh_group in "${ssh_groups[@]}"; do
fi;
fi;
while read -r username; do
# skip empty, if group exists but has no users
if [ "${username}" = "" ]; then
continue;
fi;
# check that user exists in passwd
if ! id "${username}" &>/dev/null; then
out_string="[!] User $username does not exists in /etc/passwd file";