From be86b98f674c3fec01cc0c870304591134139eac Mon Sep 17 00:00:00 2001 From: Alan Moore Date: Mon, 6 Jan 2025 23:01:51 +0000 Subject: [PATCH] Fix nullok_present.fail.sh of no_empty_passwords --- .../no_empty_passwords/tests/nullok_present.fail.sh | 4 ++-- .../tests/nullok_present_password_auth.fail.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/tests/nullok_present.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/tests/nullok_present.fail.sh index 829ef5d65575..00ae6330142f 100644 --- a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/tests/nullok_present.fail.sh +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/tests/nullok_present.fail.sh @@ -5,14 +5,14 @@ {{% if 'ubuntu' in product %}} for FILE in "/etc/pam.d/common-password"; do if ! grep -q "^[^#].*pam_unix\.so.*nullok" ${FILE}; then - sed -i 's/\([\s].*pam_unix\.so\)/\1 nullok/g' ${FILE} + sed -i 's/\(^[^#].*pam_unix\.so\)/\1 nullok/g' ${FILE} fi done {{% else %}} SYSTEM_AUTH_FILE="/etc/pam.d/system-auth" if ! $(grep -q "^[^#].*pam_unix\.so.*nullok" $SYSTEM_AUTH_FILE); then - sed -i --follow-symlinks 's/\([\s].*pam_unix\.so.*\)\s\(try_first_pass.*\)/\1nullok \2/' $SYSTEM_AUTH_FILE + sed -i --follow-symlinks 's/\(^[^#].*pam_unix\.so.*\)\s\(try_first_pass.*\)/\1nullok \2/' $SYSTEM_AUTH_FILE fi {{% endif %}} diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/tests/nullok_present_password_auth.fail.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/tests/nullok_present_password_auth.fail.sh index effd5b7c0667..88eb70d70207 100644 --- a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/tests/nullok_present_password_auth.fail.sh +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/tests/nullok_present_password_auth.fail.sh @@ -4,5 +4,5 @@ PASSWORD_AUTH_FILE="/etc/pam.d/password-auth" if ! $(grep -q "^[^#].*pam_unix\.so.*nullok" $PASSWORD_AUTH_FILE); then - sed -i --follow-symlinks 's/\([\s].*pam_unix\.so.*\)\s\(try_first_pass.*\)/\1nullok \2/' $PASSWORD_AUTH_FILE + sed -i --follow-symlinks 's/\(^[^#].*pam_unix\.so.*\)\s\(try_first_pass.*\)/\1nullok \2/' $PASSWORD_AUTH_FILE fi