server_password_set
Set the password that users must send to join in password mode, or remove it. Setting a password doesn’t change the access mode; switch to password mode with access_mode_set afterwards.
Request
Section titled “Request”Set or change the password:
{ "cmd": "server_password_set", "password": "correct horse battery" }Remove it:
{ "cmd": "server_password_set", "password": null }| Field | Type | Required | Description |
|---|---|---|---|
password |
string or null | No | The new password, 1 to 72 characters. Omit it, or send null or "", to remove the password. |
The server stores only a bcrypt hash of the password. Users send it as server_password when they authenticate.
Response
Section titled “Response”After setting:
{ "cmd": "server_password_set", "val": "Server password has been set" }After removing:
{ "cmd": "server_password_set", "val": "Server password has been removed" }Removing the password while the server is in password mode switches it to open. Every other authenticated connection then receives:
{ "cmd": "access_mode_update", "mode": "open" }Both actions are recorded in the audit log. Removal is logged as server_password_remove. The password itself is never logged.
Permissions
Section titled “Permissions”Requires manage_access. A user in timeout gets a rate_limit frame instead.
Errors
Section titled “Errors”val |
When |
|---|---|
Password must be 1-72 characters |
The password is longer than 72 characters. |
No server password is currently set |
You asked to remove the password and none is set. |
Unable to hash password |
Hashing failed. |
Unable to save password |
The server couldn’t save the new password. |
Unable to remove server password |
The server couldn’t save the removal. |
A password that isn’t a string or null returns the schema validator’s message.
