Write permission from shiny app

耗尽温柔 提交于 2020-01-13 19:53:27

问题


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

I am using a shiny app to search and save some data. I was having problems getting folder permission. After reading this (https://groups.google.com/forum/#!topic/shiny-discuss/srWETT6uL-I) I managed to solve by running this is RStudio server shell:

sudo chown shiny:shiny /path_to_app/path_to_data

However, this doesn't seem to work for me anymore. When I click my save data button in my app, I get the familiar error:

cannot open compressed file 'mutec/mutec_data.rds', probable reason 'Permission denied

So I read this (https://askubuntu.com/questions/528411/how-do-you-view-file-permissions) to try and find out the folder permissions. I get this:

Mutec_data$ ls -l ./mutec total 4 -rw-r--r-- 1 pdowns pdowns 446 Apr 17 12:22 mutec_data.rds

I'm struggling to interpret this. Does it mean that user pdowns can read and write? Should there be a "shiny" user with read and write permission?

This is my saveData function:

outputDir <- "mutec"

saveData <- function(data) {
  # Write the file to the local system
  saveRDS(
    object = data,
    file = file.path(outputDir, "mutec_data.rds") 

  )
}

Update

When I check the permissions of a folder that does let me write, I get this:

PPL040_baseline$ ls -l ./ctest total 4 -rw-rw-r-- 1 shiny shiny 105 Apr 8 06:45 Consumed.csv

Which must mean I didn't get this bit correct:

sudo chown shiny:shiny ...


回答1:


Just to confirm for anyone who isn't familiar with Ubuntu, if this (https://groups.google.com/forum/#!topic/shiny-discuss/srWETT6uL-I) doesn't work for you then add -R after chown to change the folder permission. Thanks @warmoverflow



来源:https://stackoverflow.com/questions/36676109/write-permission-from-shiny-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!