Posit Connect

Posit Connect is a publishing platform for the work your teams create in R and Python. Share Shiny applications, R Markdown reports, Plumber APIs, dashboards, plots, Jupyter Notebooks, and more in one convenient place. To learn more, visit the Posit Connect Product Page and contact your Posit Customer Success Representative.

For the latest information on integrating Package Manager with Connect, see the Integration with Posit Package Manager section of the Connect admin guide.

If you want to configure Connect to install packages from an authenticated repository, see Authenticated Repositories below.

Authenticated repositories

Getting a token

You can create a token to use for repository authentication using the rspm create token CLI command. See Creating API Tokens for details.

Configure Connect for authenticated R repositories

If any of your R repositories require authentication, you can configure credentials for Connect by creating a netrc file. This method is widely supported and provides a secure way to access authenticated repositories in R.

  1. Create a netrc file in a location that is accessible to the RunAs user (typically rstudio-connect), such as /etc/netrc.

    Add the following content, replacing [packagemanager.example.com] with your Package Manager server address and [your-token] with your actual token.

    /etc/netrc
    machine [packagemanager.example.com]
    login __token__
    password [your-token]

    The machine field should not contain a protocol, port, or repository path. If your repository URL is https://packagemanager.example.com/cran/linux/noble/latest, use packagemanager.example.com for the machine field.

  2. Create a .curlrc file in the home directory of the default RunAs user, typically at /home/rstudio-connect/.curlrc. Add the following content:

    /home/rstudio-connect/.curlrc
    --netrc-file /etc/netrc

Users should also configure credentials when deploying content by following the instructions in the Authenticated R Repositories section of the User Guide.

Warning

All deployed content can access the credentials stored in /etc/netrc. To mitigate this security risk, ensure that your API token restricts scopes to repos:read for the necessary repositories.

Configure Connect for authenticated Python repositories

If any of your Python repositories require authentication, you can configure credentials for Connect by creating a netrc file. This method is widely supported and provides a secure way to access authenticated repositories in Python.

  1. Create a netrc file in a location that is accessible to all users, such as /etc/netrc.

    Add the following content, replacing [packagemanager.example.com] with your Package Manager server address and [your-token] with your actual token.

    /etc/netrc
    machine [packagemanager.example.com]
    login __token__
    password [your-token]

The machine field should not contain a protocol, port, or repository path. If your repository URL is https://packagemanager.example.com/pypi/latest, use packagemanager.example.com for the machine field.

  1. Set the NETRC=/etc/netrc environment variable for the Connect server process. If the Connect service is managed by systemd, you can simply add the environment variable to /etc/default/rstudio-connect. If the file does not exist, create it.

    /etc/default/rstudio-connect
    NETRC=/etc/netrc
  2. Add the following lines to /etc/pip.conf, replacing packagemanager.example.com with your Package Manager server address.

    /etc/pip.conf
    [global]
    timeout = 60
    index-url = https://packagemanager.example.com/pypi/latest/simple
    trusted-host = packagemanager.example.com

Users should also configure credentials when deploying content by following the instructions in the Authenticated Python Repositories section of the User Guide.

Warning

All deployed content can access the credentials stored in /etc/netrc. To mitigate this security risk, ensure that your API token restricts scopes to repos:read for the necessary repositories.

Back to top