2023-06-13 18:47:05 +00:00
SilverBullet supports simple authentication for one or many users.
**Note**: This feature is experimental and will likely change significantly over time.
## Single User
By simply passing the `--user` flag with a username:password combination, you enable authentication for a single user. For instance:
```shell
silverbullet --user pete:1234 .
```
Will let `pete` authenticate with password `1234` .
## Multiple users
2023-11-27 16:12:47 +00:00
Although multi-user support is still rudimentary, it is possible to have multiple users authenticate. These users can be configured using a JSON authentication file that SB can generate for you. It is usually named `.auth.json` .
2023-06-13 18:47:05 +00:00
You can enable authentication as follows:
```shell
silverbullet --auth /path/to/.auth.json
```
2023-11-27 16:12:47 +00:00
To create and manage an `.auth.json` file, you can use the following commands:
2023-06-13 18:47:05 +00:00
* `silverbullet user:add --auth /path/to/.auth.json [username]` to add a user
* `silverbullet user:delete --auth /path/to/.auth.json [username]` to delete a user
* `silverbullet user:passwd --auth /path/to/.auth.json [username]` to update a password
If the `.auth.json` file does not yet exist, it will be created.
When SB is run with a `--auth` flag, this fill will automatically be reloaded upon change.
### Group management
2023-11-27 16:12:47 +00:00
While this functionality is not yet used, users can also be added to groups which can be arbitrarily named. The `admin` group will likely have a special meaning down the line.
2023-06-13 18:47:05 +00:00
When adding a user, you can add one more `-G` or `--group` flags:
```shell
silverbullet user:add --auth /path/to/.auth.json -G admin pete
```
And you can update these groups later with `silverbullet user:chgrp` :
```shell
silverbullet user:chgrp --auth /path/to/.auth.json -G admin pete
```