From 72ed2517a9a49352ff97473010892fc54490cd60 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 4 May 2022 16:41:07 +0200 Subject: Fix passwd script --- passwd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/passwd b/passwd index 7cc80b6..73228b9 100755 --- a/passwd +++ b/passwd @@ -20,11 +20,12 @@ fi PREFIX="deuxfleurs/cluster/$CLUSTER" -if ! EXISTING_PASSWORDS=$(pass $PREFIX/passwords | egrep -v "^$USERNAME:"); then - EXISTING_PASSWORDS="" -fi +EXISTING_PASSWORDS=$(mktemp) +pass $PREFIX/passwords | egrep -v "^$USERNAME:" > $EXISTING_PASSWORDS echo "Enter new password for user $USERNAME:" NEW_PASSWD=$(openssl passwd -6) -(echo $EXISTING_PASSWORDS; echo $USERNAME:$NEW_PASSWD) | pass insert -m $PREFIX/passwords +(cat $EXISTING_PASSWORDS; echo $USERNAME:$NEW_PASSWD) | pass insert -m $PREFIX/passwords + +rm $EXISTING_PASSWORDS -- cgit v1.2.3