Errror message in log after deleting files

After deleting files from nextcloud (moving to trash) there are error messages for each file in the logfile:

rename(//media/ftp_ipcam/FI9828P_00626E6BA9A6/record/alarm_20171008_153819.mkv,//media/nextcloud_data/admin/files_trashbin/files/alarm_20171008_153819.mkv.d1507529469): Operation not permitted at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#265

The files are moved to the recycle bin and I can delete them there permanently, if I wish.

Any thoughts?
Best regards
DZ

Can you validate your file permissions?

Because the media mounted at /media/ftp_ipcam/ is NTFS I get

user: root
group: root
permissions: 0777

With these settings files uploaded by the ipcam appear in nextcloud properly. Only deleting them causes the error in the log.

Tried it with ext3 formatting.
user pi, group www-data
But new files uploaded cause filepermissions only for user (pi). And so the files don’t appeare in the nextcloud-folder…

Any ideas?

Best regards
DZ

Yeah so your permissions are wrong. If it’s not external storage with its own credentials authenticated via the admin/user settings and is accessed in the data directory, it needs to belong to www-data:www-data.

Then to fix your file creation permissions you’ll need to refer back to the application that creates the file and edit the masks, presumably.

The problem is that I cannot control the file creation permissions. The origin is a IPcam. Here I only can set the ftp access data and the folder where the files are uploaded to. I use the user “pi” with it’s password on the Raspberry for the ftp settings. No chance to change the file permissions here.

Under these conditions I need a destination with owner “pi” or “root”. But now all new files uploaded have “pi” as owner, even when the folders owner is “www-data”.

For the file permissions I found a umask setting in the vsftp, so the uploaded files get the desired filepermissions.

Any hits for the owner problem?

Best regards
DZ

Are you making use of external storage there? You can then authenticate with the Pi user and Nextcloud will use that Pi user to interface the files uploaded… otherwise cronjob to script an owner change on a regular basis.

Yes I use external storage here (see picture)

But where can I authenticate with pi here?

/media/ftp_ipcam/ is the folder where the files are uploaded to. With external storage I bind them into the nextcloud admin account.

Best regards
DZ

Authentication isn’t available for the local setting, so that rules that out…

@tflidd any suggestions other than cronjob?

I just remembered that there was a way to force permissions automatically for all files created inside a certain folder. However this seems by default just possible for group, not for owner. But there is an advanced way to further auto adjust everything, see here: https://unix.stackexchange.com/questions/115631/getting-new-files-to-inherit-group-permissions-on-linux

Could this help or would it cause errors for the creating software or even nextcloud?

Why don’t you just use external FTP storage and login as the same user?

I tried it, but new files don’t appeare directly, they are not uploaded via ftp to nextcloud.

best regards
DZ

How did you upload them? Via Nextcloud (webdav, webinterface, NC-client)? Or via FTP?

once again: the files are uploaded via ftp from a ipcam to the folder /media/ftp_ipcam. This folder is integrated as external storage in nextcloud. Normally as “local”.
After your hint I tried with ftp,but this works not good, because new files in /media/ftp_ipcam are not displayed instantly.

I changed back to “local” and installed a cronjob to change the owner.

Best regards
DZ

Did you enable the option to check on changes on each direct access? Anyway it should help just to create a new dummy file via webinterface. After each file system change, the folder should be scanned again.