Command: SETPASSWORD

Purpose: Defines a password and role.

Newly installed M/Wire servers are unprotected by default and have no authentication defined. It is strongly recommended that authentication is enabled as soon as possible after M/Wire is installed on a GT.M or Caché server.

The first time SETPASSWORD is used on an unprotected M/Wire server, the client invoking the command is assumed to have a role of admin, and the password that is specified in the command will also be given a role of admin. When the +OK response is returned by the M/Wire server, the M/Wire server will now be protected and all other clients that subsequently connect to the M/Wire server will need to authenticate themselves using the AUTH command.

Once an M/Wire server is protected, subsequent use of the SETPASSWORD command is only allowed by clients that have a role of admin.

Arguments:

Argument No Description
1 The password that is being added to the authentication list.
2 The role to be assigned to the password. Valid values are user and admin. If this argument is not defined, it will default to user except for the first time SETPASSWORD is used on a previously unsecured M/Wire server, in which case it defaults to admin.

Response

Single-line response

Successful creation of a password/role returns +OK

Examples

Successful creation of password with user role by an admin:

Client: SETPASSWORD secret user
Server: +OK

Unuccessful invocation by a client with admin role:

Client: SETPASSWORD secret xxx
Server: -Invalid role

Attempt to use SETPASSWORD by a client with user role:

Client: SETPASSWORD secret user
Server: -Invalid command