diff options
author | Alex Auvolat <alex@adnab.me> | 2022-05-04 16:41:07 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-05-04 16:41:07 +0200 |
commit | 72ed2517a9a49352ff97473010892fc54490cd60 (patch) | |
tree | 92ed3d49e122b8f330866fcb3a85326ed8e609ce /passwd | |
parent | 9cae8c8fc2fc3486edb80a135ecfed02fb6840a3 (diff) | |
download | nixcfg-72ed2517a9a49352ff97473010892fc54490cd60.tar.gz nixcfg-72ed2517a9a49352ff97473010892fc54490cd60.zip |
Fix passwd script
Diffstat (limited to 'passwd')
-rwxr-xr-x | passwd | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 |