Can shiny run apps as specific users instead of shiny?

The shiny server is configured to allow users to create their apps under their home directories. But seems the server is running users' apps as shiny instead of the user and the app has no permission to access the user's home directory. The server's able to create log files under the users' home directories, but the log files are owned by shiny and only readable by shiny. What I'm looking for is a way to have the shiny server run a user's apps as the user so the apps will be able to access the user's home directory and also create logs files owned by the user. Thanks for any help.

Hi, that's an option set in the Shiny configuration file, it is called run_as, here's the reference to it in the admin guide: http://docs.rstudio.com/shiny-server/#run_as

1 Like

Thanks a lot for the info. It works!

I have reading the article,but i cannot find a method to run_as a for some app,and run_as b for other apps simultaneously,thanks a
lot

Each /location can have its own run_as setting. You can do something like

server {
  ...
  # Define the '/depts' location
  location /depts {
    run_as tim;
    # Host a directory of applications
    site_dir /srv/departmentApps;
    
    # Provide a default/global GAID
    google_analytics_id "UA-12345-1";

    # Define the '/finance' location.
    # Corresponds to the URL '/depts/finance', and the filesystem path 
    # '/srv/departmentApps/finance' as defined by the parent location.
    location /finance {
      run_as bob;
      # Provide a custom GAID for only this sub-location
      google_analytics_id "UA-54321-9";
    }
  }
...

See also the section 2.3.1 :HOME_USER: which explains how the application location can determine the user.

1 Like

your solution is great, I have solved this problem, thanks very much !