You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow location of project .Rproj.user folder to be configured by user #14778
A number of users have reported trouble related to RStudio's attempts to read / write content in the project's .Rproj.user folder. This includes, broadly:
Slow networked filesystems, where the repeated accesses made by RStudio are prohibitively slow;
Tools like Google Drive / Dropbox might lock files for editing in the .Rproj.user folder, leading to unexpected errors when saving files.
We should make it possible for users to configure the .Rproj.user directory location.
When I saved in a location that's under the home directory using ~, a directory called ~ is created in the project directory.
We might want to change "Project scratch path" to something else. I'm not sure that people will know what scratch refers to. Should I open a separate issue for this, or leave it be?
Thanks so much for adding this new configuration to RStudio Desktop and Server. You might like to know another use case it fixes. When running rstudio-server from a Docker image which is writing to a directory on a Windows 11 Dev Drive (ReFS file system) having the .Rproj.user directory on the Dev Drive shows an error/warning every few seconds such as
rsession-rstudio[77]: ERROR system error 1 (Operation not permitted) [path: /workspace/.Rproj.user/A15061CB/sources/session-32bb5c84/lock_file]; OCCURRED AT void rstudio::core::FilePath::setLastWriteTime(time_t) const src/cpp/shared_core/FilePath.cpp:1617; LOGGED FROM: void rstudio::core::FilePath::setLastWriteTime(time_t) const src/cpp/shared_core/FilePath.cpp:1617
Using this new config, setting the .Rproj.user dir location to be inside the container makes this error/warning stop.
Is there any way of setting this in one of the config files, say rserver.conf/rsession.conf, or is it only available through the Project Options window?
Is there any way of setting this in one of the config files, say rserver.conf/rsession.conf, or is it only available through the Project Options window?
Each user can specify a default scratch file location that will be used for all their projects. This is under Global Options / General / Advanced / "Default project user data directory". Note that the per-project setting (in Project Options) will override this global setting for a given project.
An admin (RStudio Server only, not desktop) can set a default for all users via the /etc/rstudio/rsession.conf file:
session-project-user-data-dir=/shared/scratch
There's also an option to prevent users from overriding a scratch path specified via rsession.conf. Set to 0 (zero) to prevent users from overriding the scratch path, 1 (one) is the default and allows overrides.
rsession-rstudio[77]: ERROR system error 1 (Operation not permitted) [path: /workspace/.Rproj.user/A15061CB/sources/session-32bb5c84/lock_file]; OCCURRED AT void rstudio::core::FilePath::setLastWriteTime(time_t) const src/cpp/shared_core/FilePath.cpp:1617; LOGGED FROM: void rstudio::core::FilePath::setLastWriteTime(time_t) const src/cpp/shared_core/FilePath.cpp:1617
This error occurs because the rstudio-server user lacks write permissions to the specified path. Specifically, the /workspace/.Rproj.user/ directory requires adjusted file permissions.
Solutions:
Modify permissions: Grant write access to the /workspace/.Rproj.user/ directory for the rstudio-server user.
Alternative approach (as suggested by @gtritchie ): Create a unified session-project-user-data-dir directory and assign appropriate permissions to it for rstudio-server user. This ensures consistent access across sessions.
Activity
ronblum commentedon Jun 17, 2024
Initial implementation might be limited to RStudio Desktop.
ronblum commentedon Jun 25, 2024
The option for changing the scratch path location isn't in the project options:

ronblum commentedon Jun 25, 2024
The was the previous build (2024.07.0-daily+245). The new build (2024.07.0-daily+250) has it. Gonna test it.
ronblum commentedon Jun 27, 2024
A few things:
~, a directory called~is created in the project directory.ronblum commentedon Jul 9, 2024
Verified no more
~directories in RStudio Desktop 2024.07.0-daily+303 on Windows 11.remlapmot commentedon Sep 25, 2024
Thanks so much for adding this new configuration to RStudio Desktop and Server. You might like to know another use case it fixes. When running rstudio-server from a Docker image which is writing to a directory on a Windows 11 Dev Drive (ReFS file system) having the .Rproj.user directory on the Dev Drive shows an error/warning every few seconds such as
Using this new config, setting the .Rproj.user dir location to be inside the container makes this error/warning stop.
Is there any way of setting this in one of the config files, say rserver.conf/rsession.conf, or is it only available through the Project Options window?
gtritchie commentedon Nov 7, 2024
Yes, this was added via #15140.
Each user can specify a default scratch file location that will be used for all their projects. This is under Global Options / General / Advanced / "Default project user data directory". Note that the per-project setting (in Project Options) will override this global setting for a given project.
An admin (RStudio Server only, not desktop) can set a default for all users via the
/etc/rstudio/rsession.conffile:There's also an option to prevent users from overriding a scratch path specified via rsession.conf. Set to 0 (zero) to prevent users from overriding the scratch path, 1 (one) is the default and allows overrides.
zhanghao-njmu commentedon Mar 15, 2025
This error occurs because the
rstudio-serveruser lacks write permissions to the specified path. Specifically, the /workspace/.Rproj.user/ directory requires adjusted file permissions.Solutions:
Modify permissions: Grant write access to the /workspace/.Rproj.user/ directory for the rstudio-server user.
Alternative approach (as suggested by @gtritchie ): Create a unified
session-project-user-data-dirdirectory and assign appropriate permissions to it forrstudio-serveruser. This ensures consistent access across sessions.