Password Reset (CLI)
When an administrator forgets their password — or gets locked out because their two-factor authentication (2FA) device is lost — you can reset the password directly from the command line using the built-in resetpwd command.
Overview
The resetpwd command updates a user's password directly in the database. It only initializes the configuration and database connection — it does not start the web server, scheduler, or leader election — so it is safe to run while gocron is running.
TIP
resetpwd locates its configuration (conf/app.ini) relative to the gocron binary, not the current directory, and automatically anchors a relative SQLite database path to gocron's base directory. So you can run it from any working directory — just use the installed binary (the same one the server runs). For SQLite, it prints the database file it connects to; verify that line matches the server's database before confirming.
Usage
gocron resetpwd [username]| Argument / Flag | Description |
|---|---|
[username] | The user to reset. Optional — defaults to admin. Matched against the username. |
--disable-2fa | Also turn off two-factor authentication for that user. |
Interactive flow
- A confirmation prompt is shown (
y/N). Anything other thany/yescancels. - You are asked to enter the new password. Input is hidden (not echoed to the terminal).
- If you type a password, you must enter it a second time to confirm. If the two entries differ, the operation is aborted and nothing is changed.
- If you leave the password blank and press Enter, a random 12-character password is generated and printed to the screen.
Examples
Reset the default admin account:
./gocron resetpwdReset a specific user:
./gocron resetpwd aliceReset the password and disable 2FA (use this when an administrator is locked out by a lost authenticator):
./gocron resetpwd admin --disable-2faInside Docker
If gocron runs in a container, exec into it and run the command against the in-container binary:
docker exec -it gocron ./gocron resetpwd adminTo also clear 2FA:
docker exec -it gocron ./gocron resetpwd admin --disable-2faTroubleshooting
gocron is not installed; cannot reset password— the binary cannot find a completed installation (conf/app.ini+ install lock) next to it. Use the installed gocron binary — the same one the server runs (in Docker, exec into the running container).user [xxx] not found— the username does not exist, or you are connected to a different database than expected. Double-check the username and the database configured inconf/app.ini.
WARNING
For security, prefer letting the tool generate a random password (leave the input blank). After regaining access, log in and change the password through the web interface, and re-enable 2FA if it was disabled.