1

This is a follow up question to this: (write.csv permisson shiny server - R).

I am using shiny to write a .csv file locally (shiny server). To do this I had to make shiny the owner of the sub directory by doing this:

sudo chown shiny:shiny /path_to_app/sub_with_csv_in

see: (https://groups.google.com/forum/#!topic/shiny-discuss/srWETT6uL-I)

..which worked nicely. Now I want to update the .csv saved in "sub_with_csv_in" by running a script outside of the app. However, because I changed the permission, now I get:

In file(file, ifelse(append, "a", "w")) :
  cannot open file 'Available.csv': Permission denied

..when I run my script outside of shiny. So my question is, is it possible to have shiny own a directory while keeping the permission to write to the same directory outside of shiny?

Community
  • 1
  • 1
Pete900
  • 2,016
  • 1
  • 21
  • 44
  • There are probably at least two ways of doing this. Granting write access to a group (something like 664), of which shiny and some others are, or allow writing to others (a la 666). – Roman Luštrik Apr 06 '16 at 07:51
  • Thanks Roman. Can you just give me some pointers on what the code should look like. I'm very new to Ubuntu. – Pete900 Apr 06 '16 at 08:00
  • Perhaps something like chmod from this page? https://help.ubuntu.com/community/FilePermissions – Pete900 Apr 06 '16 at 08:00
  • 1
    Since you have `sudo`, you can run your R script as the `shiny` user. Just `sudo su shiny`, then run your script. – Xiongbing Jin Apr 06 '16 at 14:25
  • thanks @warmoverflow. So to clarify, can I put this within the script itself or do I have to open the shell within RStudio and run 'sudo su shiny' then close the shell and run script? – Pete900 Apr 07 '16 at 05:12
  • 3
    You need to run `sudo su shiny` and then `Rscript your_script.R`, both in shell. – Xiongbing Jin Apr 07 '16 at 13:44

0 Answers0