The following method sets up a single user in the RStudio server that also has ‘write’ access in the Shiny server. Using Samba, we will create a shared folder inside the RStudio server user that maps directly to the shiny-server folder inside the Shiny server. The assumption is made that the ‘client’ RStudio server is running an Ubuntu (Debian) distribution.

The plan is to:

  1. Create a user in the Shiny and RStudio server with the same name and password
  2. Install and configure the Samba server in the Shiny server
  3. Install and configure the Samba client in the RStudio server
  4. Point the shiny-server folder to a local folder in the RStudio server’s user

In the Shiny server

  • Open a new terminal session in the Shiny Server
  • We’ll create the new user, give it ‘admin’ access and then we remove the need for it to use the ‘sudo’ command

    sudo adduser shiny-user
    sudo usermod -aG sudo shiny-user
    sudo chown shiny-user /srv/shiny-server/
    sudo chgrp sudo /srv/shiny-server/
  • Install Samba

    sudo apt-get install samba
    sudo smbpasswd -a shiny-user [typed password twice]
  • Open the smb.conf file for editing

    sudo nano /etc/samba/smb.conf
  • Add the following lines at the end of the smb.conf file:

    [shiny-server]
    comment = Shiny Server Share
    path=/srv/shiny-server/
    browsable = yes
    valid users = shiny-user
    read only = no
  • Close the file by typing CRTL+X, then Y and enter
  • Restart the Samba server

    sudo service smbd restart

    In the RStudio server

  • Start a terminal session in the ‘client’ RStudio Server
  • Create the new user

    sudo adduser shiny-user
  • In a web browser session, navigate to the RStudio server and log on as ‘shiny-user’
  • Create a folder called shiny-server
  • Switch back to the terminal session in the RStudio server
  • Install the Samba client

    sudo apt-get install cifs-utils
  • Open the fstab file for editing. This file contains the necessary information to automate the process of mounting shares

    sudo nano /etc/fstab
  • Add the following lines at the end of the file

    //[ Shiny server's Internal IP Address]/shiny-server  /home/shiny-user/shiny-server  cifs  username=shiny-user,password=shiny-user
  • Close the file by typing CRTL+X, then Y and enter
  • ‘Mount’ the share, which means that the internal folder now points to the folder in the external Shiny server

    sudo mount -a
  • Go back to the web browser that has the RStudio session
  • Click on the shiny-server folder. If there were any previously published apps in the Shiny server, then they should show up in the this folder now.
  • To confirm that the permissions are correct, create a new Shiny app, called server_test inside the shiny-server folder
  • Navigate to your new app by going to: http://MY_PUBLIC_DNS:3838/server_test