Skip to content

Directories and Files

Connect documents its owners and modes in more detail than the other two products.1 This page lists them, starting with the config and logs and then the data directory. The guide writes root for paths owned by the server process; if Connect runs as an unprivileged account such as rstudio-connect, read root as that account.

Configuration, program files, and logs

The config file can hold credentials, so only the Connect service user may read it. The logs are private for the same reason.

Path Owner Mode What it holds
/etc/rstudio-connect/rstudio-connect.gcfg root 0600 All Connect settings, including encrypted secrets.
/opt/rstudio-connect/ Not documented Not documented Program files and CLIs. Upgrades overwrite them, so do not edit.
/var/log/rstudio/rstudio-connect/rstudio-connect.log root 0600 Service log.
/var/log/rstudio/rstudio-connect/rstudio-connect.access.log root 0600 HTTP access log.
/var/log/rstudio/rstudio-connect/rstudio-connect.audit.log root 0600 Audit log, when enabled (off by default).
/var/lib/rstudio-connect/<license-file>.lic root 0600 License file.2

Data directory

The data directory, /var/lib/rstudio-connect/ (Server.DataDir), is locked down at the top and opened only where content needs it. The diagram below shows ownership moving from root to rstudio-connect deeper in the tree.

flowchart TD
    Root[("/var/lib/rstudio-connect/<br/>root 0701")]
    Root --> Apps[("apps/<br/>root 0711")]
    Root --> Reports[("reports/<br/>root 0711")]
    Root --> Pkgs[("packrat/, python-environments/<br/>rstudio-connect")]
    Root --> Priv[("R/, metrics/<br/>rstudio-connect 0700")]
    Root --> Other[("other folders<br/>root 0700")]
    Apps --> AppID[("APP_ID/<br/>root 0700")]
    AppID --> Bundle[("BUNDLE_ID/<br/>RunAs user, 0750 / 0640")]
    style Root fill:#f1eaf6,stroke:#7a4f9a,stroke-width:2px,color:#1a1a1a
    style Bundle fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
Path Owner Mode What it holds
/var/lib/rstudio-connect/ root 0701 Data root.
Unlisted subdirectories root 0700 The default for anything not below.
apps/ root 0711 Deployed bundles. APP_ID/ is root 0700.
apps/APP_ID/BUNDLE_ID/ RunAs user, group rstudio-connect 0750 dirs, 0640 files Bundle source. The owner changes when the RunAs user changes.
reports/ root 0711 Rendered output. Each RENDERING_ID/ is rstudio-connect 0700.
bookmarks/ root 0711 Shiny bookmarks. APP_ID/ is rstudio-connect 0770.
packrat/ rstudio-connect:rstudio-connect 0750 dirs, 0640 files R packages installed for content.
python-environments/ rstudio-connect:rstudio-connect 0700 top, 0750 below, 0640 files Python environments and the pip cache.
R/ rstudio-connect:rstudio-connect 0700 dirs, 0600 files Connect's private R library, hidden from content.
metrics/ rstudio-connect 0700 Usage metrics.
db/ Not documented Not documented Database.Dir: the SQLite database and the encryption key, db/secret.key.3
jobs/ Not documented Not documented Output from each process, removed after 30 days.
bundles/, tmp/, trash/ Not documented Not documented Uploaded bundles, Server.TempDir, and items waiting for deletion.
/var/lib/rstudio-connect-local/ Not documented Not documented Server.LocalDataDir: node local data. Connect will not start if it cannot write here.

Where the directories can live

Connect also checks where these directories sit. Breaking any of these rules stops Connect from starting or risks data loss.

  • Install directory: Connect will not start if Server.DataDir, SQLite.Dir, Server.TempDir, Database.Dir, or Server.LandingDir sits under /opt/rstudio-connect.
  • SQLite: the database must be on a local filesystem, not NFS.
  • One filesystem: trash/ and the content folders (apps, bookmarks, bundles, images, reports, overrides, python-environments, otel) must share one mount, so moves between them stay atomic.
  • Local data: Server.LocalDataDir stays on each node's local disk, even when Server.DataDir is shared.

Checking owners and modes

Run the checks before and after a change, and save the output with the change record. After a restore, migrate repair resets content directory ownership.4

sudo stat -c '%U:%G %a %n' /etc/rstudio-connect/rstudio-connect.gcfg /var/lib/rstudio-connect
sudo namei -l /var/lib/rstudio-connect/apps

Summary

Root owns the config, the logs, and the top of the data directory, all private. The rstudio-connect account owns the package libraries, and each RunAs user owns its bundle. Keep the SQLite database local and the content folders on one filesystem. The commands that change these files are on Sudo Commands.