17 User Management Command-Line Interface

Connect includes a CLI (command-line interface) for some basic user management tasks. This utility helps you list users and modify user roles in the event that no one can access a Connect administrative user account.

The user management utility is installed at /opt/rstudio-connect/bin/usermanager. It uses the configuration defined in /etc/rstudio-connect/rstudio-connect.gcfg unless you specify an alternate configuration file with the --config flag.

The usermanager utility must be run as root.

The usermanager utility can only be run when Connect is stopped. See Section 2.2 for information on stopping and restarting Connect.

17.1 Commands

The usermanager utility supports two commands:

  • list: Lists users
  • alter: Changes a user’s role

17.2 Flags

17.2.1 Configuration for usermanager:

  • --config: The full or relative path to a Connect configuration file (.gcfg). Defaults to /etc/rstudio-connect/rstudio-connect.gcfg.

17.2.2 Flags for the list command:

  • --include-locked: Includes locked user accounts in the list.

17.2.3 Flags for the alter command:

  • --username: Specifies the user name of the user to alter.
  • --role: Specifies the role to set for the user. Allowed roles are viewer, publisher, and administrator.
  • --force: Force demotion of the last remaining administrator.

17.3 Examples:

List unlocked users:

sudo ./bin/usermanager list

List all users (locked and unlocked):

sudo ./bin/usermanager list --include-locked

Specify a custom configuration file

sudo ./bin/usermanager --config /etc/connect/mycustomconfig.gcfg list

Promote the user john to an administrator role

sudo ./bin/usermanager alter --username john --role administrator

Demote the last remaining administrator to a non-administrative role

sudo ./bin/usermanager alter --username admin --role publisher --force