# Users and invites

> Add people to your Hub with invites or from the command line, manage roles, reset passwords and two-step verification, and delete accounts.

Source: https://docs.posternmail.app/admin/users/

One Hub can hold several people. Each person has their own account with their own mailboxes,
settings, devices and encryption key. This page explains how people get an account, what admins
can do for them, and what happens when an account is deleted.

The first account is created by the setup wizard (see [Set up your Hub](https://docs.posternmail.app/setup/)). Everything
after that happens in the admin panel of the web app (**Settings → Admin**) or with
`postern-hub admin` on the server.

## Roles

There are two roles:

| Role | Can do |
|---|---|
| **Member** | Use the Hub: add their own mailboxes, read and send mail, manage their own devices, passkeys and two-step verification. |
| **Admin** | Everything a member can, plus the admin panel: Hub name, who may join, invites, other people's passwords, disabling accounts, the Google and Microsoft sign-in clients, and the list of every mailbox on the Hub with its sync status. |

Admins can see the address, owner and sync status of every mailbox on the Hub, but not anyone
else's mail. There is no "super user" view of another person's inbox.

Rules that protect the Hub from losing its last admin:

- The person who completes the setup wizard is an admin.
- The first account created with `admin create-user` is always an admin, even without `--admin`.
- The last active admin cannot be disabled, demoted or deleted while other people have an
  account. The Hub answers "This is the only administrator. Make another user an administrator
  first."
- In the admin panel you cannot disable or reset yourself: the buttons only appear next to other
  people.

> [!NOTE]
> Changing the role of an existing account is not available in the admin panel or the CLI yet.
> The Hub's API accepts it (`PATCH /api/v1/admin/users/{id}` with `{"role": "admin"}`, see the
> [API reference](https://docs.posternmail.app/reference/api/)), but there is no button for it. To make someone an
> admin today, invite them with the **Admin** role or create them with `--admin`.

## Who can join: registration

The **New accounts** setting in **Settings → Admin → Your Hub** decides whether invite links work.
It has two values:

| Value | Shown as | What it means |
|---|---|---|
| `invite` | **By invite** | Default. Admins create invite links; each link creates one account. Nobody can sign up without one. |
| `closed` | **Closed** | Nobody can join. Existing invite links stop working ("This invite can't be used") until you switch back. |

There is no open sign-up: a Hub never lets strangers create accounts on their own. Two ways
around the setting exist, both under your control as the admin:

- `postern-hub admin create-user` on the server works in either mode.
- Single sign-on with `POSTERN_OIDC_AUTO_REGISTER=true` creates accounts for new people from your
  identity provider in either mode. See [Sign-in methods](https://docs.posternmail.app/admin/sign-in/#single-sign-on-oidc).

## Invite someone

### In the admin panel

1. Open **Settings → Admin** and, under **People**, click **Invite someone**.
2. Optionally fill in **Their email (optional)**. With an address, only that person can use the
   link: the account must be created with exactly that email. Leave it empty for a link anyone
   can use.
3. Choose the **Role**: **Member** or **Admin**.
4. Click **Create invite link**. The dialog shows the link ("Send this link. It works once and
   expires in 7 days."). Click **Copy link** and send it to the person yourself. The Hub does not
   send email.

The link looks like `https://mail.example.com/invite/7RTk4K-6ekKi_orMcTed`. The person opens it,
sees **Join** followed by your Hub's name, and enters their name, email and a password of at least 10
characters. They are signed in right away and land in the web app, where they can add their
first mailbox.

**Open invites** lists every unused invite with its address (or "Anyone with the link"), its role
and when it expires. **Copy link** copies it again; the bin icon revokes it ("The link stops
working."). Used invites disappear from the list.

> [!IMPORTANT]
> The link is built from `POSTERN_PUBLIC_URL`. If that is not set, the Hub uses the address your
> browser used to open the admin panel. Make sure the person can reach that address: a link
> that starts with `http://localhost:8080` only works on the Hub's own machine.

### From the command line

`postern-hub admin invite` creates the same kind of invite.

| Flag | Default | Meaning |
|---|---|---|
| `--email E` | none | Only this address can use the invite. |
| `--role member\|admin` | `member` | The role of the new account. |

**Docker Compose:**
```sh
cd ~/postern
docker compose exec hub postern-hub admin invite --email alex@example.com --role member
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
```sh
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec postern-hub admin invite --email alex@example.com --role member'
```
**Desktop app (built-in Hub):**
The desktop app's built-in Hub has no command line. Use **Settings → Admin → Invite someone**
in the app. Keep in mind that the built-in Hub only listens on `127.0.0.1`, so other people
cannot reach it from their devices: move to a server first (see
[Backups and restore](https://docs.posternmail.app/admin/backups/#move-from-the-desktop-app-to-a-server)).

The output:

```text
✓ Invite created (member, valid until 2026-12-12T15:33Z)
  https://mail.example.com/invite/7RTk4K-6ekKi_orMcTed
```

Without `POSTERN_PUBLIC_URL` it prints `Open <your Hub address>/invite/<code>` and a reminder to
set the variable. Unlike the admin panel, the CLI does not refuse an address that already has an
account; such an invite simply cannot be used.

### Invite rules

| Rule | Value |
|---|---|
| Lifetime | 7 days from creation. Unused expired invites are deleted automatically. |
| Uses | One. The second person to open the link gets "This invite is invalid, expired or already used". |
| Email lock | With an email, any other address gets "This invite is for a different email address". |
| Registration closed | The link shows "This invite can't be used". |
| Account type | Email and password. Two-step verification and passkeys are added afterwards in **Settings → Security**. |

## Create an account on the command line

`postern-hub admin create-user` creates an account directly, without an invite and without the
setup wizard. It works when registration is closed and before the Hub has ever been opened in a
browser.

| Flag | Required | Meaning |
|---|---|---|
| `--email E` | yes | The sign-in email. Stored in lower case. It does not have to be a mailbox you connect. |
| `--name N` | yes | Display name, up to 100 characters. |
| `--password P` | no | At least 10 characters. Without it the Hub generates one (four groups of five letters and digits) and prints it. |
| `--admin` | no | Make the account an admin. The first account on a Hub is always an admin. |

**Docker Compose:**
```sh
cd ~/postern
docker compose exec hub postern-hub admin create-user --email alex@example.com --name "Alex Smith"
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
```sh
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec postern-hub admin create-user --email alex@example.com --name "Alex Smith"'
```
**Desktop app (built-in Hub):**
Not available: the built-in Hub has no command line. Create the first account in the app's
setup screen and invite everyone else from **Settings → Admin**.

```text
✓ Created member alex@example.com (usr_01m93debcyh0ddt55f539tfqzt)
  Password: gEhdF-jKgmT-msm8w-dX5u5
  Ask the user to change it after signing in.
```

Pass the password on privately. The person changes it in **Settings → Account → Password**.

> [!TIP]
> Avoid `--password` on shared machines: the value ends up in your shell history and is visible
> in the process list while the command runs. Let the Hub generate one instead.

Possible errors:

| Message | Cause |
|---|---|
| `--email: enter a valid email address` | The address is empty or malformed. |
| `--name is required` | `--name` is missing or blank. |
| `--password must be at least 10 characters` | The password is too short. |
| `An account with this email address already exists` | Each email can have one account. |

## List accounts

**Docker Compose:**
```sh
cd ~/postern
docker compose exec hub postern-hub admin list-users
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
```sh
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec postern-hub admin list-users'
```
**Desktop app (built-in Hub):**
Not available on the command line. **Settings → Admin → People** lists everyone.

```text
EMAIL              NAME        ROLE    2FA   STATUS    CREATED     ID
you@example.com    Sam Smith   admin   totp  active    2026-11-02  usr_01m8...
alex@example.com   Alex Smith  member  -     disabled  2026-12-05  usr_01m9...
```

| Column | Values |
|---|---|
| `2FA` | `totp` when two-step verification is on, otherwise `-`. Passkeys are not shown here. |
| `STATUS` | `active`, `disabled` (an admin disabled the account) or `deleting` (scheduled for deletion by `delete-user`, see below). |

**Settings → Admin → People** shows the same people with their number of mailboxes, whether
two-step verification is on and when one of their devices was last seen.

## Reset a password

Use this when someone forgot their password. The old password stops working immediately and
**every device of that person is signed out**.

**In the admin panel:** **Settings → Admin → People**, then **Reset password…** next to the
person. After you confirm, a dialog shows a temporary password once ("Pass it on privately. It
isn't shown again"). The person signs in with it and sets a new one in **Settings → Account**.

**On the command line:**

| Flag | Required | Meaning |
|---|---|---|
| `--email E` | yes | The account. |
| `--password P` | no | The new password (at least 10 characters). Without it a temporary one is generated and printed. |

**Docker Compose:**
```sh
cd ~/postern
docker compose exec hub postern-hub admin reset-password --email alex@example.com
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
```sh
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec postern-hub admin reset-password --email alex@example.com'
```
**Desktop app (built-in Hub):**
Not available on the command line. Another admin can use **Reset password…** in
**Settings → Admin**. If you are the only person on the built-in Hub and forgot your password,
there is no reset: see the [desktop app page](https://docs.posternmail.app/apps/desktop/).

```text
✓ Password reset for alex@example.com; all of their devices were signed out.
  Temporary password: Pq7xK-mnRt3-ZbW9c-4hJkd
```

The CLI is the way back in when **you** are the admin who forgot the password: it needs access
to the server, not an account. The reset appears in the person's security log as "Password
changed".

## Turn off two-step verification for someone

If someone lost their authenticator app and their recovery codes, an admin can turn two-step
verification off for them. This is only possible on the command line, there is no button in
the admin panel.

**Docker Compose:**
```sh
cd ~/postern
docker compose exec hub postern-hub admin disable-2fa --email alex@example.com
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
```sh
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec postern-hub admin disable-2fa --email alex@example.com'
```
**Desktop app (built-in Hub):**
Not available: the built-in Hub has no command line.

```text
✓ Two-factor authentication disabled for alex@example.com
```

It removes the authenticator secret and all recovery codes. The person's devices stay signed
in and their passkeys keep working. They can sign in with their password alone and set up
two-step verification again in **Settings → Security**. Confirm who is asking before you do
this: it removes the second factor that protects the account.

## Disable an account

**Settings → Admin → People → Disable…** blocks an account without deleting anything. The person
is signed out everywhere and cannot sign in ("This account has been disabled.") until you click
**Enable**. Their mailboxes, mail and settings are kept. Disabling only blocks sign-in: the Hub
keeps syncing their mailboxes in the background. There is no CLI command for this.

## Delete an account

Deleting an account removes the person and everything they have on the Hub. There are two ways:

- The person deletes their own account in **Settings → Account → Delete account…**. They have to
  enter their password.
- An admin runs `postern-hub admin delete-user`. The admin panel has no delete button.

| Flag | Meaning |
|---|---|
| `--email E` | The account to delete (required). |
| `--yes` | Do not ask. Without it the command asks "Delete … and ALL of their mailboxes, mail and settings? This cannot be undone. [y/N]", and without a terminal it stops with "aborted (pass --yes to confirm non-interactively)". |

**Docker Compose:**
```sh
cd ~/postern
docker compose exec hub postern-hub admin delete-user --email alex@example.com
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
```sh
sudo -u postern sh -c 'set -a; . /etc/postern/hub.env; exec postern-hub admin delete-user --email alex@example.com'
```
**Desktop app (built-in Hub):**
Not available on the command line. A person can delete their own account in
**Settings → Account → Delete account…**.

```text
✓ alex@example.com is signed out everywhere and scheduled for deletion.
  The running Hub deletes the account and its data within a minute.
```

The command signs the person out at once and marks the account for deletion. The running Hub
finishes the job within a minute; if the Hub is stopped, it does so on its next start.
`list-users` shows the account as `deleting` until then.

### What is deleted

From the Hub:

- the account, its devices and sessions, passkeys, two-step verification secret and recovery
  codes, security log and settings;
- every mailbox of the account with its saved sign-in (password or OAuth token);
- the Hub's copy of their mail: messages, threads, folders, the search index, attachments and
  the encrypted files in `blobs/`;
- their tags, Spaces, splits, templates, identities, sender lists, rules and rule history, drafts
  and queued sends;
- the person's own encryption key.

Not deleted:

- **Mail at the providers.** Postern never deletes anyone's Gmail, Outlook or IMAP mail when an
  account goes away. Tags that Postern stored as IMAP keywords (`$MC_...`) stay on the mail
  server.
- **Copies on devices.** Desktop and mobile apps remove their local copy the next time they
  connect and find the session gone.
- **Backups.** See below.

> [!WARNING]
> **Deleted accounts stay in backups.** Scheduled backups and the `pre-migrate-*.db` copies the Hub
> makes before upgrades still contain the account, its mail and its encryption key. Anyone with
> those backups and the Hub's master key can restore them. If you promise someone deletion (for
> example under the GDPR), delete or wait out the backups too. See
> [Backups and restore](https://docs.posternmail.app/admin/backups/#deleted-accounts-and-the-gdpr).

## Each person's data and key

Every account gets its own random data key when it is created. That key encrypts the person's
saved mailbox sign-ins, their two-step verification secret, their passkeys and the files in
`blobs/` (message bodies, attachments, uploads). The data key itself is stored in the database,
encrypted with the Hub's master key (`hub.key`).

What that means in practice:

- One person's data cannot be decrypted with another person's key.
- Deleting an account deletes its key, so any leftover encrypted file of that person is
  unreadable from then on.
- Everyone depends on the one master key file. Lose it and nobody's data can be read. Back it up
  (see [Backups and restore](https://docs.posternmail.app/admin/backups/)).
- People's own exports: **Settings → Account → Your data → Download** gives each person a JSON
  file with their profile, devices, passkey names, security log, settings, mailboxes (without
  their passwords or tokens), tags, Spaces, rules, templates and drafts. It does not contain the
  mail itself.

More about the encryption: [Encryption](https://docs.posternmail.app/security/encryption/).
