Storing files

59 views
Skip to first unread message

bordero...@gmail.com

unread,
Jun 19, 2017, 10:30:10 AM6/19/17
to opencpu
Hello,

I try to write files to a location other than the opencpu working directory (/tmp /ocpu-temp /).
However, I am unable to do so.

I tried several solutions but I still have the same problem.

I have edited my /etc/apparmor.d/opencpu.d/custom file:
/home/adrien/test rw,

I have the following error with an OpenCPU call:

Can not open the connection

In call:
File (con, "w")

Do you have a solution ?

Jeroen Ooms

unread,
Jun 19, 2017, 10:34:17 AM6/19/17
to ope...@googlegroups.com
Usually it's better to write the file to the working directory and
download the file via the API. If you need state, it's better to have
R connect to a database rather than storing files on the server.

> I have edited my /etc/apparmor.d/opencpu.d/custom file:
> /home/adrien/test rw,

I assume you use apparmor. Can you check if there is any DENIED lines
in /var/log/kern.log ? You might also need to add write access to the
directory to create the file:

/home/adrien/ rw,

After updating rules make sure you:

sudo service apparmor restart
sudo apachectl restart

bordero...@gmail.com

unread,
Jun 19, 2017, 11:09:10 AM6/19/17
to opencpu
Yes, I know, but I have to use a cache system with the R.cache package.

I added /home/adrien/ rw to the custom file,

I still have the same mistake.

here is any DENIED lines in /var/log/kern.log :

Appointment = "DENIÉ" operation = "open" profile = "opencpu-exec" name = "/ proc / 24737 / fd /" pid = 24737 fsuid = "r" denied_mask = 33 ouid = 0
Rendezvous = "DENIED" operation = "open" profile = "opencpu-exec" name = "/ proc / Sys / kernel / shmmax" pid = 24737 fsuid request_mask = "r" denied_mask = "r" = 33 Ouid = 0
Rendezvous = "DENIÉ" operation = "open" profile = "opencpu-exec" name = "/ proc / 24737 / cmdline" pid = 24737 comm = "apache2" requested_mask = "r" denied_mask = "r" fsuid = Ouid = 0
Apprenor = operation "DENIED" = "mknod" profile = "opencpu-exec" name = "/home /adrien /test/toto.json" pid = 24737 comm = "apache2" requested_mask = "c" denied_mask = "c" fsuid = 33 ouid = 33

Jeroen Ooms

unread,
Jun 19, 2017, 11:11:48 AM6/19/17
to ope...@googlegroups.com
On Mon, Jun 19, 2017 at 4:48 PM, <bordero...@gmail.com> wrote:
> here is any DENIED lines in /var/log/kern.log :
>
> Apprenor = operation "DENIED" = "mknod" profile = "opencpu-exec" name = "/home /adrien /test/toto.json" pid = 24737 comm = "apache2" requested_mask = "c" denied_mask = "c" fsuid = 33 ouid = 33
>

If you want to write files inside /home/adrien/test you need a rule like this:

/home/adrien/test/ rw,
/home/adrien/test/** rw,

Also note that I'm not even sure apache might have permission to write
in the home dir of 'adrien' (even without apparmor).

bordero...@gmail.com

unread,
Jun 20, 2017, 4:58:12 PM6/20/17
to opencpu, bordero...@gmail.com
Yes, I know, but I have to use a cache system with the R.cache package.

I added /home/adrien/ rw to the custom file,

I still have the same mistake.

here is any DENIED lines in /var/log/kern.log :

Appointment = "DENIÉ" operation = "open" profile = "opencpu-exec" name = "/ proc / 24737 / fd /" pid = 24737 fsuid = "r" denied_mask = 33 ouid = 0
Rendezvous = "DENIED" operation = "open" profile = "opencpu-exec" name = "/ proc / Sys / kernel / shmmax" pid = 24737 fsuid request_mask = "r" denied_mask = "r" = 33 Ouid = 0
Rendezvous = "DENIÉ" operation = "open" profile = "opencpu-exec" name = "/ proc / 24737 / cmdline" pid = 24737 comm = "apache2" requested_mask = "r" denied_mask = "r" fsuid = Ouid = 0
Apprenor = operation "DENIED" = "mknod" profile = "opencpu-exec" name = "/ home / Adrien / test / toto.json" pid = 24737 comm = "apache2" requested_mask = "c" denied_mask = "c" fsuid = 33 ouid = 33
Reply all
Reply to author
Forward
0 new messages