What determines path when you start rstudio-server?



I do not understand this behavior:
In bash terminal:

balter@spectre:~/microbiome$ which R
balter@spectre:~/microbiome$ which python

In Rstudio terminal:

> system('echo hello')
> system('whoami')
> system('echo $PATH')
> system('which python')
> system('which R')
> system('which conda')

I am starting rstudio server with sudo rstudio-server start.


I'm not an expert in RStudio Server, but it's my understanding that it runs as its own user (by default rstudio-server). So that probably explains why it has a different PATH variable to you, sitting in an interactive bash session. You can also override the R used by RStudio Server, although I don't think that's what you're looking for.

This conversation on setting the environment variables might help, though!


I think you really hit on something. I creating a .bash_profile for the rstudio-server user to set the path. That didn't work. I also tried using the server-user=myuser method for my user name as done here. Neither loaded the environment. So, I'm still working on it. But I think you correctly identified the problem.


This answer says that you can use either a .Renviron or .Renviron.site file in lieu of .bash_profile :slight_smile: