Skip to content

Sudo Commands

Connect is controlled through systemctl, with command line tools under /opt/rstudio-connect/bin/. Its configuration file and data directory belong to root or the service account, so these commands run with sudo. This page lists them by task.

Service and configuration

A restart applies every change to rstudio-connect.gcfg; settings marked reloadable in the configuration reference can be applied with a reload instead. Check the file first, because a bad setting stops Connect from starting.

Command What it does
sudo systemctl status rstudio-connect Shows whether Connect runs.
sudo systemctl restart rstudio-connect Restarts Connect so it reads the config file.
sudo /opt/rstudio-connect/bin/connect --check-config Validates the config file and reports each check; safe while Connect runs.1
sudo /opt/rstudio-connect/bin/connect restore-admin --find <name> Finds a user to promote when no administrator can sign in.1
sudo /opt/rstudio-connect/bin/rscadmin runtime-restrictions Reports which R, Python, and Quarto versions publishers may use, and where each rule comes from.1

Licensing

The license manager is a separate binary in /opt/rstudio-connect/bin/.2 Each command needs sudo.

Command What it does
sudo /opt/rstudio-connect/bin/connect license-status Reports the license with the key masked.1
sudo /opt/rstudio-connect/bin/license-manager status Shows the license state and expiry.
sudo /opt/rstudio-connect/bin/license-manager activate <license-key> Activates a key online.
sudo /opt/rstudio-connect/bin/license-manager deactivate Releases the key.
sudo /opt/rstudio-connect/bin/license-manager status-offline Shows the offline license state.
sudo /opt/rstudio-connect/bin/license-manager activate-offline-request <license-key> Writes a request file for an offline server.
sudo /opt/rstudio-connect/bin/license-manager activate-offline <activation-file> Applies the activation file from Posit.
sudo /opt/rstudio-connect/bin/license-manager deactivate-offline Writes an offline deactivation request.

Secrets

Connect encrypts secrets in the config file with a key stored on the server.3 Losing or resetting that key makes the encrypted values unrecoverable, so back it up with the data directory.

Command What it does
sudo /opt/rstudio-connect/bin/rscadmin encrypt-config-value Encrypts a value, such as an SMTP or LDAP password, for the config file. Stop Connect first.1
sudo /opt/rstudio-connect/bin/rscadmin reset-secret-key Resets the key signature after a mismatch. Encrypted data becomes unrecoverable.1

Users, content, and audit

usermanager handles user changes and audit exports. With SQLite, every subcommand except roles needs Connect stopped; with PostgreSQL, they run while Connect runs.1

flowchart TD
    Task(["usermanager task"]) --> DB{"Database?"}
    DB -->|"PostgreSQL"| Run("Run while Connect runs")
    DB -->|"SQLite"| Roles{"Subcommand is<br/>roles?"}
    Roles -->|"yes"| Run
    Roles -->|"no"| Stop("i. systemctl stop rstudio-connect")
    Stop --> Cmd("ii. Run usermanager")
    Cmd --> Start("iii. systemctl start rstudio-connect")
    Run --> Record(["Record the change"])
    Start --> Record
    style Stop fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
    style Start fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
Command What it does
sudo /opt/rstudio-connect/bin/usermanager list Lists users or groups.
sudo /opt/rstudio-connect/bin/usermanager alter --username <user> --new-role publisher Changes a user's role.4
sudo /opt/rstudio-connect/bin/usermanager alter --username <user> --lock Locks a departed user, keeping their content and history.4
sudo /opt/rstudio-connect/bin/usermanager transfer --source-username <user> --target-username <new-owner> Moves a user's content to a new owner.4
sudo /opt/rstudio-connect/bin/usermanager audit --csvlog Exports the audit log as CSV for the validation record.4
sudo /opt/rstudio-connect/bin/usermanager delete Deletes a user or group. Prefer locking.1
sudo /opt/rstudio-connect/bin/usermanager tokens and deactivate Lists tokens, and deactivates all or selected ones.1
sudo /opt/rstudio-connect/bin/usermanager roles Lists each role's permissions; runs while Connect runs.1
sudo /opt/rstudio-connect/bin/migrate db Copies SQLite data into PostgreSQL. Stop Connect first.1
sudo /opt/rstudio-connect/bin/migrate repair Resets ownership and modes of content directories.1

After an upgrade, start Connect once before running usermanager transfer or alter --new-owner.1

Summary

Every Connect config change ends in a restart, so run --check-config before it. On SQLite, plan usermanager work for a maintenance window, because Connect must be stopped. Back up the encryption key with the data directory. The files these commands touch are on Directories and Files.