[elbe-devel] [PATCH v2 2/8] finetuning: use chpasswd for user password

Bastian Germann bage at linutronix.de
Fri Jun 24 12:11:40 CEST 2022


Am 16.06.22 um 12:10 schrieb Holger Dengler:
> Use batch-mode tool "chpasswd" for setting user passwords. It allows the
> processing of plain-text and hashed passwords.
> 
> Signed-off-by: Holger Dengler <holger at hdengler.de>

Reviewed-by: Bastian Germann <bage at linutronix.de>

> ---
>   elbepack/finetuning.py | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
> index 52051223b..920d7bba3 100644
> --- a/elbepack/finetuning.py
> +++ b/elbepack/finetuning.py
> @@ -276,9 +276,8 @@ class AddUserAction(FinetuningAction):
>               chroot(target.path, cmd)
>   
>               if 'passwd' in att:
> -                cmd = "passwd %s" % self.node.et.text
> -                stdin = "%s\n%s\n" % (att["passwd"], att["passwd"])
> -                chroot(target.path, cmd, stdin=stdin)
> +                stdin = "%s:%s" % (self.node.et.text, att["passwd"])
> +                chroot(target.path, "chpasswd", stdin=stdin)
>   
>   
>   @FinetuningAction.register('addgroup')


More information about the elbe-devel mailing list