diff options
author | zsdc <taras@vyos.io> | 2023-11-14 18:15:43 +0200 |
---|---|---|
committer | zsdc <taras@vyos.io> | 2023-11-14 18:21:54 +0200 |
commit | 6ee88ac6387ce0dbb570bde3e9c4582b206580aa (patch) | |
tree | 564e94ce1975a04bcb0e1c83bf884e0f3d2fdce2 | |
parent | c8645bdde89f2d61d31f030ea1f193791c627a3d (diff) | |
download | vyatta-cfg-system-6ee88ac6387ce0dbb570bde3e9c4582b206580aa.tar.gz vyatta-cfg-system-6ee88ac6387ce0dbb570bde3e9c4582b206580aa.zip |
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.
-rwxr-xr-x | scripts/standalone_root_pw_reset | 2 |
1 files changed, 1 insertions, 1 deletions
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 } |