Access denied when writing to file in RStudio Server

2.9k views Asked by At

In RStudio Server I want to write to the directory /var/www/r_diagnostics:

f <- "/var/www/r_diagnostics/test.txt"
writeLines("test", con = f)

The name of my user is randomuser.

> system("whoami")
randomuser

The directory permissions for r_diagnostics are set as:

drwxrwxrwx  2 randomuser randomuser   4096  6. Jan 18:15 r_diagnostics

What can I do about it?

1

There are 1 answers

0
Matthew Lundberg On BEST ANSWER

To write a file, you have to find the directory. This requires execute permission for each element in the path. Execute permission allows you to find a directory's contents.

Plus, you also need write permission to the final leaf directory in order to modify a file (you had that already).