From 2899914e33cdc83479d3818d37811019f638756b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 11 Oct 2023 15:06:13 +0200 Subject: [SSPS] Force-remove users >= 1000 --- satellit_installer/includes/10-handle_users.inc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/satellit_installer/includes/10-handle_users.inc b/satellit_installer/includes/10-handle_users.inc index d0dab50..9063a40 100644 --- a/satellit_installer/includes/10-handle_users.inc +++ b/satellit_installer/includes/10-handle_users.inc @@ -26,15 +26,14 @@ add_user_nohome() { } kill_user() { - echo -n "# Terminating user account id $1, leaving user home/files as they were: " - userdel $(getent passwd "$1" | cut -f 1 -d ":") || perror "# could not kill userid ${1}!" - echo " ok." + echo "# Terminating user account id $1" + userdel -r -f $( < /etc/passwd awk -F: '$3 == 1000 {print $1}' ) || perror "# could not kill userid ${1}!" } check_users() { echo "#" echo "# Checking for users to kill with id>=1000: " - for userid in $(cat /etc/passwd|cut -f 3 -d ":"|sort -n); do + for userid in $( < /etc/passwd cut -f 3 -d ":" | sort -n ); do case $userid in 65534) echo "# Ignoring user 65534/sync." ;; *) [ "$userid" -ge 1000 ] && kill_user "$userid" -- cgit v1.2.3-55-g7522