From 4629b58a7e35a04246bf944de0048419a80b9de5 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Mon, 11 Nov 2024 17:06:24 +0900 Subject: [PATCH] Skip empty group on login check --- bin/check_last_login.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/check_last_login.sh b/bin/check_last_login.sh index ae1987b..7cfbec8 100755 --- a/bin/check_last_login.sh +++ b/bin/check_last_login.sh @@ -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";