Shiny permissions with rmarkdown::render

0

I have a Shiny App that is locally running without errors. The app involves creating a tempfile for rendering a PDF and then downloading it. When deployed, the server disconnects when rendering the PDF. I am almost certain the problem lies in user permissions in my linux server where the shiny app is hosted.

I have tried sudo chown -R tvc:shiny-apps . and sudo chmod g+w and sudo chmod g+s within the app folder but no permissions changed. I am also not sure if I have to change permissions in the app folder, or if I have to change permissions in the temp folder.

Here is a sample of the code using tempfiles in the shiny server :

tmp_file <- paste0(tempfile(), ".pdf") #Creating the temp where the .pdf is going to be stored

      render(caminho_rmd, 
             output_file = tmp_file,
             params = params, 
             envir = new.env())

      report$filepath <- tmp_file #Assigning in the temp file where the .pdf is located to the reactive file created above


      })

Here are user permissions for the files in the shiny app folder:

-rw-r--r-- 1 "user" "group" app.R (this is the shiny app)

I am confident the problem lies in the directory permissions, but I am not sure if I have to change permissions in the app folder, or if I have to change permissions in the temp folder.

Thanks in advance for any help.