diff options
author | Simon Rettberg | 2023-10-11 15:06:13 +0200 |
---|---|---|
committer | Simon Rettberg | 2023-10-11 15:06:13 +0200 |
commit | 2899914e33cdc83479d3818d37811019f638756b (patch) | |
tree | 02ee2771c166691b3769e1291a94add3faa96d57 /satellit_installer | |
parent | Gixc arugment oreder (diff) | |
download | setup-scripts-2899914e33cdc83479d3818d37811019f638756b.tar.gz setup-scripts-2899914e33cdc83479d3818d37811019f638756b.tar.xz setup-scripts-2899914e33cdc83479d3818d37811019f638756b.zip |
[SSPS] Force-remove users >= 1000
Diffstat (limited to 'satellit_installer')
-rw-r--r-- | satellit_installer/includes/10-handle_users.inc | 7 |
1 files 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" |