Can't access directories outside of home directory in RStudio Server

Hi,

I'm running RStudio Server from a Rocker container using Singularity.
I can run the container and access RStudio Server in my browser with appropriate tunnelling :slight_smile:

However, I've been struggling with making directories outside my home directory accessible in RStudio.
The minimal working call would be something like:

mkdir -p run var-lib-rstudio-server
printf 'provider=sqlite\ndirectory=/var/lib/rstudio-server\n' > database.conf

singularity exec \
  --bind run:/run,var-lib-rstudio-server:/var/lib/rstudio-server \
  --bind database.conf:/etc/rstudio/database.conf \
  tidyverse_latest.sif \
  rserver  --server-user=${USER} --www-address=127.0.0.1

I want to access files stored in a share mounted at /data.
So I added this option to the singularity call --bind /data \, which indeed makes it available from the shell, but not from within RStudio.

I then read about Restricted Directories, so I created a custom session config file and tried to bind it too, but this doesn't help…

My call now looks like

mkdir -p run var-lib-rstudio-server
printf 'provider=sqlite\ndirectory=/var/lib/rstudio-server\n' > database.conf
printf 'restrict-directory-view=0\ndirectory-view-allow-list=/data\n' > rsession.conf

singularity exec \
  --bind /data \
  --bind run:/run,var-lib-rstudio-server:/var/lib/rstudio-server \
  --bind database.conf:/etc/rstudio/database.conf \
  --bind rsession.conf:/etc/rstudio/rsession.conf \
  tidyverse_latest.sif \
  rserver  --server-user=${USER} --www-address=127.0.0.1

I would be very grateful for guidance on how to access these files. It seems like I'm not the first to run on this issue (see e.g. RStudio does not see some directories on server cluster) but I can't find relevant instructions. Thank you very much.

1 Like

There is two ways to access files outside of the home-directory:

  1. command line / console use setwd("/data") and then use the "Files" ==> "More" ==> "Go to Working Directory"
  2. if in the "Files" pane, there is a "..." at the right corner of the field containing "Home" which - if clicked - allows you to change to any directory you want.

You could consider setting session-default-working-dir=/data provided the user's have enough access privileges for /data.

The logic with the restrict-directory-view and directory-view-allow-list is meant the other way around, i.e. directory-view-allow-list will only work when restrict-directory-view=1, i.e. only make selected folders visible when any other folder view is prohibited. In addition to the "default" folders, the IDE will only show and allow access to the directories configured via directory-view-allow-list.

More information about directory management you can find at RStudio Workbench Administration Guide - 38  Directory Management

Please note: The restrict-directory-view setting will only restrict directory view in the IDE's File Pane, it is not in effect on the R console or on the Terminal where you still can see and browser to any folder the operating system allows you to access. One could consider this more of a "cosmetic" limitation that will nevertheless prevent a majority of the users (that are not that comfortable with the terminal and R Console) to not access other folders.

Thanks a lot for taking time to help. I realise reading your answer and re-reading my initial post that I incompletely described my issue.

I (of course…) knew about the 2 ways you describe to browse the file system – I'm very new to rserver and rsession but a rather seasoned R user.

My problem is that the list of directories and files displayed with either method is not the same when I browse them via this RStudio Server instance using Rocker, or if I simply ssh to the server. Let's make the example somewhat more concrete. On this HPC server, home directories as well as data are stored in a share – let's call it /gpfs in this example.
So my home directory lives at /gpfs/home/mygroup/myuser and my data at /gpfs/home/mygroup/data/.
When I start RStudio Server as described above, every parent directory of my home directory lists only one subdirectory: the one which belongs to my home directory's path. So I can't access my data directory for instance… This is why I suspected that this had something to do with Restricted directory (btw I read the section 38 of the manual you mentioned and even refer to it with a link in my initial post).

Concrete steps that would help me would be to learn how to list the option used by rserver when it's called because I'm not sure the way I set restrict-directory-view to 0 is not overrides by some pre-existing config file…
I apologize for not making my point clear in the first place, and hope you or someone else can help me getting this up and running.

1 Like

Please let me know if my questions are not clear enough or what additional info to provide.
Thank you very much in advance for your help.

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.