From f1de91ff9c27b1bb5762d6929a7636a652c9284c Mon Sep 17 00:00:00 2001 From: zsdc Date: Tue, 14 Nov 2023 18:15:43 +0200 Subject: boot: T5739: Fixed password recovery This change fixes a filter used for `sed` during password reset in the `set_encrypted_password()` function. Old logic: search between `user username {` and the first line with `}` does not work for users with extra options in config, like public keys. New logic: search between `user username {` and the first line with `encrypted-password` which should cover all possible combinations, except situations when a password is not presented in a configuration file. (cherry picked from commit 6ee88ac6387ce0dbb570bde3e9c4582b206580aa) --- scripts/standalone_root_pw_reset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/standalone_root_pw_reset b/scripts/standalone_root_pw_reset index 1a73de71..c82cea32 100755 --- a/scripts/standalone_root_pw_reset +++ b/scripts/standalone_root_pw_reset @@ -28,7 +28,7 @@ ADMIN=vyos set_encrypted_password() { sed -i \ - -e "/ user $1 {/,/}/s/encrypted-password .*\$/encrypted-password $2/" $3 + -e "/ user $1 {/,/encrypted-password/s/encrypted-password .*\$/encrypted-password \"$2\"/" $3 } -- cgit v1.2.3