Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default defineConfig({
text: 'Guides',
items: [
{text: 'AI Agents (MCP)', link: '/docs/mcp'},
{text: 'Manage users via CLI', link: '/docs/user-cli'},
{text: 'Migrate to 3.x', link: '/docs/migrate-to-3'},
{text: '(more) Push message examples', link: '/docs/more-pushmsg'},
{text: 'OpenID Connect', link: '/docs/oidc'},
Expand Down
2 changes: 2 additions & 0 deletions docs/first-login.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ After setting up gotify/server you can log in to the WebUI. On first launch an i
Once logged in you can create your own user(s) and, if desired, delete the default account (after creating another administrator account). You can also remove any username/password overrides from your configuration, they are only used to create this initial account.

If you keep the default account, be sure to change its password so it is not `admin`!

Lost the admin password? See [Manage users via CLI](/docs/user-cli).
49 changes: 49 additions & 0 deletions docs/user-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Manage users via CLI

The `gotify-server user` commands (available since 3.2.0) change users directly
in the database. Use them to recover access when you lost the admin password or
no admin account is left.

::: warning
Stop the server before running the commands, Gotify may not work correctly when
users are changed while the server is running.
:::

```bash
# change the password of a user
$ gotify-server user set-password admin

# create a new user, --admin makes it an admin
$ gotify-server user create --admin rescue

# grant or revoke admin permissions
$ gotify-server user set-admin alice true
```

Without a password argument, you are prompted for it. You can also pass it as
the last argument, e.g. `gotify-server user set-password admin newpassword`,
but it may then show up in your shell history.

## Configuration

The commands load the configuration as described in
[Configuration](/docs/config). Run them with the same configuration and in the
same working directory as the server.

## Docker

Run the command with the same image version, volumes, environment variables and
config file as your server. Otherwise it may use a different database or migrate
it to a newer version.

```bash
# docker compose
$ docker compose stop <gotify-service-name>
$ docker compose run --rm <gotify-service-name> user set-password admin
$ docker compose start <gotify-service-name>

# docker
$ docker stop <gotify-container-name>
$ docker run --rm -it -v /var/gotify/data:/app/data gotify/server:<gotify-version> user set-password admin
$ docker start <gotify-container-name>
```