forked from Deuxfleurs/nixcfg
Fix passwd script
This commit is contained in:
parent
9cae8c8fc2
commit
72ed2517a9
1 changed files with 5 additions and 4 deletions
9
passwd
9
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
|
||||
|
|
Loading…
Reference in a new issue