From 42f838c90f11c352baa674f25ed65e3f5371a450 Mon Sep 17 00:00:00 2001 From: Alan Moore Date: Wed, 8 Jan 2025 14:47:51 +0000 Subject: [PATCH] use xargs in correct_value.pass.sh --- .../accounts_root_gid_zero/tests/correct_value.pass.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_root_gid_zero/tests/correct_value.pass.sh b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_root_gid_zero/tests/correct_value.pass.sh index 4a477ce1f1e..f2ca6274d99 100644 --- a/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_root_gid_zero/tests/correct_value.pass.sh +++ b/linux_os/guide/system/accounts/accounts-restrictions/root_logins/accounts_root_gid_zero/tests/correct_value.pass.sh @@ -2,8 +2,5 @@ # remediation = none {{% if 'ubuntu' in product %}} -users_to_remove=$(awk -F: '$4 == 0 && $1 !~ /^(root|sync|shutdown|halt|operator)$/ {print $1}' /etc/passwd) -for user in $users_to_remove; do - sudo userdel -rf "$user" -done +awk -F: '$4 == 0 && $1 !~ /^(root|sync|shutdown|halt|operator)$/ {print $1}' /etc/passwd | xargs --no-run-if-empty -I '{}' userdel -f '{}' {{% endif %}}