Unable to use ${USER} variable in default working dir configuration using rsession.conf

Hello RStudio / posit community,

I encountered a similar error, which was already described here.
Due to the fact that I could not re-open the topic and that no solution was suggested, I just created this new topic and hope to find a solution.

I also do not want to use the /home directory for the users and tried to change this in the settings. Thus, each user should end up in a specific folder such as /new_home/${USER} , which would be directly achievable if the /etc/rstudio/rsession.conf expands the variable ${USER}.

Therefore, I considered the following steps and was partially successful but not completely:

  • I changed the rsession.conf (including${USER} does create a folder ‘${USER}’ but no user specific folders):
#> R code
cat /etc/rstudio/rsession.conf
# R Session Configuration File

session-timeout-minutes=0
session-save-action-default=no
session-default-working-dir=/new_home
session-default-new-project-dir=/new_home
  • Furthermore, I changed the working directory, which was also mentioned here
cat /usr/lib64/R/etc/Rprofile.site
# https://solutions.posit.co/envs-pkgs/rsw_defaults/
options(repos = c(CRAN = {{ cran_repos | map("to_json") | join(", ") }}))
setwd(file.path("/new_home",Sys.getenv("USER")))

This changes the working directory in the R Runtime, however, session-default-working-dir still points to the other directory.
I suggest that this a reason why I create now the .Rhistory in the /new_home folders instead of the final user specific folders in which it should be created.

Is it planned that the rsession.conf will expand variables in the next release?

If you have a bug report or feature request to make for RStudio, the best place for it would be the GitHub repository.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.