GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — OpenFM/set-setup-password.sh at main · DB0SL/OpenFM

Expand file tree

/

set-setup-password.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
49 lines (38 loc) · 1.22 KB
/

set-setup-password.sh

Copy path

File metadata and controls

executable file
·
49 lines (38 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# set-setup-password.sh
# Setzt das Setup-Passwort in mmdvmdb.config.setup_password (Klartext)
set -euo pipefail
DB_NAME="mmdvmdb"
DB_USER="root" # ggf. anpassen, z.B. "root" o.ä.
# Muss als root laufen (direkt oder via sudo)
if [[ "$EUID" -ne 0 ]]; then
echo "Dieses Skript muss als root ausgeführt werden (sudo ./set-setup-password.sh)."
exit 1
fi
echo "Setup-Passwort für Datenbank '$DB_NAME'."
# Passwort verdeckt einlesen
read -s -p "Neues Setup-Passwort: " PW1
echo
read -s -p "Neues Setup-Passwort (Wiederholung): " PW2
echo
# Prüfen ob identisch
if [[ "$PW1" != "$PW2" ]]; then
echo "Fehler: Passwörter stimmen nicht überein."
exit 1
fi
if [[ -z "$PW1" ]]; then
echo "Fehler: Passwort darf nicht leer sein."
exit 1
fi
# Für SQL escapen: Backslash und einfache Anführungszeichen
pw_sql=${PW1//\\/\\\\}
pw_sql=${pw_sql//\'/\'\\\'\'}
SQL="UPDATE config SET setup_password = '$pw_sql' WHERE id = 1;"
echo "Schreibe Setup-Passwort in die Datenbank..."
# Wenn der DB-User ein Passwort hat, wird mysql dich ggf. interaktiv fragen (-p)
if mysql -u"$DB_USER" "$DB_NAME" -e "$SQL"; then
echo "Setup-Passwort wurde erfolgreich aktualisiert."
else
echo "Fehler: MySQL-Update fehlgeschlagen."
exit 1
fi
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.