Changing the system account for RStudio Workbench / RStudio Server


The user account that RStudio Workbench (previously RStudio Server Pro) runs under in the normal course of operations is rstudio-server. This account is automatically added to the system during installation and is created as a system account rather than end user account (i.e. the --system flag is passed to useradd).

You can configure RStudio Workbench so that it will run from a different system account with the following steps:

  1. Create a system user if one doesn't already exist
  2. Assign this user to the server-user option in the /etc/rstudio/rserver.conf configuration file
  3. Delete the log and temporary files associated with RStudio Workbench.
  4. Restart RStudio Workbench

Once completed, you will see that rstudio-server now runs as the new user. For example, if your new user was called myuser you would run the following commands:

sudo useradd --system myuser
sudo echo 'server-user=myuser' >> /etc/rstudio/rserver.conf
sudo rm -rf /var/log/rstudio-server
sudo rm -rf /var/lib/rstudio-server
sudo rm -rf /tmp/rstudio-rsession
sudo rm -rf /tmp/rstudio-rserver
sudo rstudio-server restart
ps aux | grep myuser

Keep in mind that management tasks performed using the rstudio-server utility will stay the same even when you change the RStudio Workbench system account. The rstudio-server utility enables the stopping, starting, and restarting of the server as well as many other management functions.