Resetting a user's state on RStudio Workbench / RStudio Server



For version 1.4 of RStudio Workbench (previously RStudio Server Pro) and later, user files are stored in two separate locations to make it easier to manage which objects get removed when you reset the user's state. If these directories do not exist, RStudio will create them on startup.

Location Information stored
~/.config/rstudio/ All user settings (Global Options)
~/.local/share/rstudio/ All open files and tabs, as well as active and suspended sessions.

These location can be configured with environment variables. Please see this section of the admin guide for details.

In addition, for all versions of RStudio Workbench / RStudio Server, R stores user session information in several files that may also need to be moved or renamed in order to reset the user's session fully. These are the .RData file (containing data and R objects; for more see here)  and the .Rhistory file (containing the command history; for more see here).

When resetting a user's state in any version of RStudio Workbench / RStudio Server, we recommend renaming these directories to create a backup version instead of completely deleting them. This allows you to save your settings and history, in case you want to revert back to them. Additionally, if you experienced a crash or the user is not able to log in, this directory may contain vital information for determining the source of the error. In this case, we recommend renaming these directories and sending them to RStudio Support if requested.

Resetting RStudio's state for a user:

To reset RStudio's state in version 1.4 and later:

The  .config, and .local directories, as well as the .RData and .Rhistory files, are located in each user's default working directory (typically their home directory). 

  1. Navigate to the user's working directory. Note that if you are using RStudio Projects, these will have their own session files that may need to be reset separately (for instance, if a user is unable to load RStudio while working in a Project).
  2. Choose which directory or directories to rename , via the command sudo mv /home/user1/.local/share/rstudio /home/user1/.local/share/rstudio-old, for example. This table shows the impact of the directory removal.
    Location When deleted
    ~/.config/rstudio/ All user settings (Global Options) lost
    ~/.local/share/rstudio/ All open files, tabs, and sessions deleted
    In most cases, you will only need to rename the .local/share/rstudio directory to clear out the sessions, and the user settings are retained. Rename both directories to mimic a fresh installation for that user.
  3. Open a fresh browser window and log into RStudio Workbench / RStudio Server.

Note that this will only reset the state for that particular user. 

If you are using RStudio Projects, we'd also recommend resetting the project-specific state if you're having issues - you can do this by navigating to the Project's folder in your file browser, and renaming the .Rproj.user directory there.

Older versions of (version 1.3 of RStudio Server Pro and earlier) used a non-configurable folder named .rstudio to store state; this must also be renamed or deleted to reset state in these older versions.