B Command-Line Interface

Connect includes a usermanager command for some basic 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.

Connect’s usermanager CLI also includes the ability to dump audit logs. By default, the logs are displayed in a formatted table, but you can also choose to output comma-separated values for easy analysis in other tools.

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 5.1 for information on stopping and restarting Connect.

B.1 Commands

The usermanager utility supports the following commands:

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

B.2 Flags

Configuration for usermanager:

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

Flags for the list command:

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

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.

Flags for the audit command:

  • --csv: Output comma-separated values

B.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

Dump audit logs to screen

sudo ./bin/usermanager audit

Dump audit logs (comma-separated) to a file:

sudo ./bin/usermanager audit --csv > ~/audits.txt