forked from mendersoftware/integration
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset-user
More file actions
executable file
·26 lines (22 loc) · 789 Bytes
/
Copy pathreset-user
File metadata and controls
executable file
·26 lines (22 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
# removes the current user account, acts as a password reset utility
# after resetting the account, the user will be prompted to re-create it; no data will be lost
# Detect docker-compose command
DOCKER_COMPOSE_COMMAND=$(docker compose version &>/dev/null && echo 'docker compose' || echo 'docker-compose')
while true; do
read -p "This will reset the user account. Do you want to continue (y/n)" -n 1 yn
echo
case $yn in
[y]* )
exec ${DOCKER_COMPOSE_COMMAND} \
exec \
mender-mongo-useradm \
mongo useradm --eval "db.users.remove({})"
break;;
[n]* )
echo "Aborting."
exit;;
* )
echo "Please answer (y)es or (n)o.";;
esac
done