Support

Resetting a user's state on RStudio Server

Follow

Overview

For version 1.2 of RStudio Server and earlier, users' custom settings, session information and options are all stored in a hidden directory called .rstudio. If this directory does not exist, RStudio will create it on startup. This directory includes user settings, log files, and other state information. Removing (or renaming) this directory will reset RStudio's state for that user, analogous to a fresh installation. 

For version 1.3 of RStudio Server and later, user files are stored in three separate locations to make it easier to manage which objects get removed when you reset the user's state. The hidden directory called .rstudio still contains session information, but two other hidden directories contain user settings and open files. 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
~/.rstudio/ All active and suspended sessions

The first two locations in the table above can be configured with environment variables, though the third cannot. Please see this section of the admin guide for details.

In addition, for all versions of 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 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.2 and earlier:

The .rstudio directory, 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. Rename the .rstudio directory and the .RData and .Rhistory files (for instance, via the command sudo mv /home/user1/.rstudio /home/user1/.rstudio-old)
  3. Open a fresh browser window and log into 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.

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

The .rstudio , .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/.rstudio /home/user1/.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 and tabs lost
    ~/.rstudio/ All active and suspended sessions deleted
    In most cases, you will only need to rename the .rstudio directory to clear out the sessions, and the user settings and open files can be retained. Rename all three directories to mimic a fresh installation for that user.
  3. Open a fresh browser window and log into 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.

 

Comments