Sen4CAP / sen4cap-services

Sen2Agri Extensions for Sen4CAP
1 stars 1 forks source link

Uploading LPIS data permissions error #1

Closed kalxas closed 4 years ago

kalxas commented 4 years ago

Hi, We are facing an error when we upload an LPIS shapefile: image

Looks like the folder gets created in /mnt/uploads/[site] folder but with ownership by apache user and cannot be moved to the /mnt/uploads/lpis/ folder by the sen4cap user.

Any workarounds?

lnicola commented 4 years ago

Sorry for this. I'll have to look more into it, but a quick workaround would be to run chmod -R 777 /mnt/archive/uploads. chown -R apache: /mnt/archive/uploads might also work.

kalxas commented 4 years ago

I have tried both before sending the issue, the problem is that the uploaded folder is created as apache and the default permissions is 644, so the sen4cap user fails to move it to another folder.

lnicola commented 4 years ago

I'm not sure why another system user tries to move the directory. You could also chmod -R 777 /mnt/upload? That way the other user should be able to move it.

kalxas commented 4 years ago

so if I understand correctly, all file manipulation actions happen from the apache user?

lnicola commented 4 years ago

I would have to check, but that was my original assumption. But if another system user tries to move the files from the original upload folder, making it 777 should prevent the permissions error.

That's because moving /mnt/upload/foo/ to /mnt/other/bar/ requires:

kalxas commented 4 years ago

I have provided 777 to all folders under /mnt/archive and /mnt/upload and I get the same error:

image

Here are the folder permissions in the setup:

image

kalxas commented 4 years ago

I also changed owner to sen2agri-service:

image

and get the same error.

That tells me that files are uploaded with default 644 permissions from apache user but the move is happening from sen2agri-service user which does not have permission to move the /mnt/upload/test_site_1/sen4cap_1580942568141 folder

kalxas commented 4 years ago

While uploading files I changed the permission of the uploaded folder to 777 and I get the same error, so the problem must be something else.

kalxas commented 4 years ago

It looks like the files actually get uploaded in /mnt/archive/upload/lpis/test_site_1/

image

A new folder is getting created as can be seen in the terminal. Can this be a timeout error being thrown because it is taking more time to copy than expected?

kalxas commented 4 years ago

Thank you @lnicola for your help, I managed to fix the problem, it was related to the permissions of the files uploaded in the zip file.

lnicola commented 4 years ago

I'm glad you got it fixed. We should test a similar scenario and validate the uploaded files or fix their permissions, because it seems impossible to debug otherwise.

kalxas commented 4 years ago

yes, I had to make sure the files were a+rwx and the zip file not containing a folder, just plain files.