matrix-docker-ansible-deploy/docs/registering-users.md
Suguru Hirahara 28c28e1e00
Replace <domain> with example.com
Signed-off-by: Suguru Hirahara <acioustick@noreply.codeberg.org>
2024-10-18 04:02:59 +09:00

3.6 KiB

Registering users

This documentation page tells you how to create user account on your Matrix server.

Table of contents:

Registering users manually

You can do it via this Ansible playbook (make sure to edit the <your-username> and <your-password> part below):

just register-user <your-username> <your-password> <admin access: yes or no>

# Example: `just register-user john secret-password yes`

or by invoking ansible-playbook manually:

ansible-playbook -i inventory/hosts setup.yml --extra-vars='username=<your-username> password=<your-password> admin=<yes|no>' --tags=register-user

or using the command-line after SSH-ing to your server (requires that all services have been started):

/matrix/synapse/bin/register-user <your-username> <your-password> <admin access: 0 or 1>

Note: <your-username> is just a plain username (like john), not your full @<username>:example.com identifier.

You can then log in with that user via the Element service that this playbook has created for you at a URL like this: https://element.example.com/.


If you've just installed Matrix, to finalize the installation process, it's best if you proceed to Configuring service discovery via .well-known

Managing users via a Web UI

To manage users more easily (via a web user-interace), you can install Synapse Admin.

Letting certain users register on your private server

If you'd rather keep your server private (public registration closed, as is the default), and let certain people create accounts by themselves (instead of creating user accounts manually like this), consider installing and making use of matrix-registration.

Enabling public user registration

To open up user registration publicly (usually not recommended), consider using the following configuration:

matrix_synapse_enable_registration: true

and running the installation procedure once again.

If you're opening up registrations publicly like this, you might also wish to configure CAPTCHA protection.

Adding/Removing Administrator privileges to an existing Synapse user

To change the admin privileges for a user, you need to run an SQL query like this against the synapse database:

UPDATE users SET admin=ADMIN_VALUE WHERE name = '@USER:example.com';

where:

  • ADMIN_VALUE being either 0 (regular user) or 1 (admin)
  • USER and example.com pointing to a valid user on your server

If you're using the integrated Postgres server and not an external Postgres server, you can launch a Postgres into the synapse database by:

  • running /matrix/postgres/bin/cli - to launch psql
  • running \c synapse - to change to the synapse database

You can then proceed to run the query above.

Note: directly modifying the raw data of Synapse (or any other software) could cause the software to break. You've been warned!