mirror of
https://github.com/bigbeartechworld/big-bear-scripts.git
synced 2026-07-22 05:31:58 -04:00
Add CasaOS reset username and password
This commit is contained in:
5
reset-password-for-casaos/README.md
Normal file
5
reset-password-for-casaos/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Run command
|
||||
|
||||
```bash
|
||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/reset-password-for-casaos/run.sh)"
|
||||
```
|
||||
23
reset-password-for-casaos/run.sh
Normal file
23
reset-password-for-casaos/run.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Prompt user for confirmation
|
||||
read -p "Do you want to reset your CasaOS username and password? (y/n): " response
|
||||
|
||||
if [[ "$response" != "y" ]]; then
|
||||
echo "Please try resetting the username and password first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if user.db exists
|
||||
if [[ ! -f /var/lib/casaos/db/user.db ]]; then
|
||||
echo "user.db does not exist. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Backup user.db
|
||||
sudo mv /var/lib/casaos/db/user.db /var/lib/casaos/db/user.db.backup
|
||||
|
||||
# Restart casaos-user-service
|
||||
sudo systemctl restart casaos-user-service.service
|
||||
|
||||
echo "Commands executed successfully. Visit CasaOS UI again and the welcome screen should present to reset password."
|
||||
Reference in New Issue
Block a user