Manage users from the CLI
Create and delete Datashare users with the datashare user subcommands.
The datashare user subcommands let you provision and remove users directly from the command line, without writing SQL or Redis commands by hand:
user create
Create a Datashare user
user delete
Delete a Datashare user and all their owned data
Run these commands with the same data-store settings as your server (--dataSourceUrl, and --redisAddress if your deployment uses Redis) so they operate on the same user inventory.
Create a user
datashare user create alice --email alice@example.orgThe login can be passed as a positional argument (as above) or with --login. Useful options:
--email
RFC 5322 email address
--name
Display name (default: login)
--password
Password, for the local provider
--provider
local, oauth or external (default: local)
--groups
Comma-separated project names the user can access
--if-not-exists
Idempotent: exit 0 if the user already exists
--json
Emit a JSON result on stdout
--no-input
Disable interactive prompts
For example, to create a local user with a password and access to two projects:
datashare user create alice \
--email alice@example.org \
--password "$PW" \
--groups project1,project2Or to provision a user authenticated by an external identity provider (see OAuth2):
With Docker Compose, prefix the command with the web container's entrypoint:
Delete a user
Deleting a user removes the user and all their owned data. This cannot be undone.
--yes, -y
Skip the confirmation prompt
--if-exists
Idempotent: exit 0 if the user doesn't exist
--json
Emit a JSON result on stdout
--no-input
Disable interactive prompts (forces --yes)
Scripting
All user subcommands are script-friendly: combine --json (machine-readable output), --no-input (no prompts) and the idempotency flags (--if-not-exists / --if-exists) to write provisioning scripts that can safely be re-run:
Related pages
User management for choosing an authentication method and the user record format.
Manage projects from the CLI for granting users a role on a project.
Last updated