Nextcloud 11.0.2 and delete folder on SMB share

I have Nextcloud 11.0.2 installed and the data is on a smb share, Windows 2008 R2.
I can create and delete files and create folders but not delete.

I get this error:
{“reqId”:“M0YSn8hkupO5EImtmrk5”,“remoteAddr”:“194.103.240.26”,“app”:“no app in context”,“message”:“Exception: {“Exception”:“Icewind\\SMB\\Exception\\NotFoundException”,“Message”:“Invalid request for \/5_TEKNIK\/Anl\u00e4ggning\/Projekt\/P\u00e5g\u00e5ende projekt\/57 Dep\u00e5 sprinklers\/P\u00e5g\u00e5ende projekt\/57 Dep\u00e5 sprinklers\/Avtal (NotFoundException)”,“Code”:0,“Trace”:”#0 \/var\/www\/nextcloud\/apps\/files_external\/3rdparty\/icewind\/smb\/src\/Share.php(398): Icewind\\SMB\\Parser->checkForError(Array, ‘\/5_TEKNIK\/Anl\\xC3\\xA4…’)\n#1 \/var\/www\/nextcloud\/apps\/files_external\/3rdparty\/icewind\/smb\/src\/Share.php(140): Icewind\\SMB\\Share->parseOutput(Array, ‘\/5_TEKNIK\/Anl\\xC3\\xA4…’)\n#2 \/var\/www\/nextcloud\/apps\/files_external\/lib\/Lib\/Storage\/SMB.php(129): Icewind\\SMB\\Share->stat(’\/5_TEKNIK\/Anl\\xC3\\xA4…’)\n#3 \/var\/www\/nextcloud\/apps\/files_external\/lib\/Lib\/Storage\/SMB.php(171): OCA\\Files_External\\Lib\\Storage\\SMB->getFileInfo(’\/5_TEKNIK\/Anl\\xC3\\xA4…’)\n#4 \/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Common.php(175): OCA\\Files_External\\Lib\\Storage\\SMB->stat(‘P\\xC3\\xA5g\\xC3\\xA5ende proj…’)\n#5 \/var\/www\/nextcloud\/apps\/files_external\/lib\/Lib\/Storage\/SMB.php(230): OC\\Files\\Storage\\Common->filemtime(‘P\\xC3\\xA5g\\xC3\\xA5ende proj…’)\n#6 \/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php(374): OCA\\Files_External\\Lib\\Storage\\SMB->hasUpdated('P\\xC3\\xA5g\\xC3:

Nextcloud: 11.0.2
OS: Ubuntu 16.10
Apache: 2.4.18-2ubuntu4
PHP: 7.0

Watch out, if your data store is actually on top of an SMB share, your Nextcloud database is going to get out of sync with the actual files as soon as you make any changes to them outside of Nextcloud.
Aside from that gotcha, you probably just need to verify that Nextcloud has the correct permissions to the SMB share.

No no, it’s just setup as external storage, not that the data directory is located there.

Mvh
Håkan Björk

16 mars 2017 kl. 15:45 skrev Eric <noreply@nextcloud.commailto:noreply@nextcloud.com>:

    linucksrox<https://help.nextcloud.com/users/linucksrox>

March 16

Watch out, if your data store is actually on top of an SMB share, your Nextcloud database is going to get out of sync with the actual files as soon as you make any changes to them outside of Nextcloud.
Aside from that gotcha, you probably just need to verify that Nextcloud has the correct permissions to the SMB share.

That’s good. How exactly are your permissions set up on the Windows share? As in right click the share, properties, sharing, advanced sharing, permissions. What do you have in there?
Then which user are you connecting as from Nextcloud?

Nextcloud is connecting with it’s own ADaccount that has Full on the share and Modify on the folder.

But not on the parent folders. I have only set it on the main folder and subfolders

The share is \servername\foldername1smb://servername/foldername1 and from that it’s foldername2\foldername3\foldername4 and NTFS rights is set on foldername3 and recursive from that.

In nextcloud the config is:
Servername: servername1 share: shared
Remote subfolder: 5_TEKNIK\Anläggning\Projekt

On folder Anläggning and under the nextcloud aduser have NTFS rights modify.

Mvh
Håkan Björk

17 mars 2017 kl. 13:17 skrev Eric <noreply@nextcloud.commailto:noreply@nextcloud.com>:

[https://help.nextcloud.com/letter_avatar_proxy/v2/letter/l/8baadc/45.png] linucksroxhttps://help.nextcloud.com/users/linucksrox
March 17

That’s good. How exactly are your permissions set up on the Windows share? As in right click the share, properties, sharing, advanced sharing, permissions. What do you have in there?
Then which user are you connecting as from Nextcloud?

Apparently with NTFS, the only permission that allows deleting files is the full control permission. If you only set Modify, that explains why you are seeing this behavior. As a reference: http://www.ntfs.com/ntfs-permissions-file-folder.htm

Hi

Thank you for your reply.

Unfortunately thats not right. Modify is enough. Full only gives you permission to change owner of files and folders.
But I have tried to use Full also.

Before I created this thread I googled alot about this problem and from what I found out the problem is that nextcloud/owncloud is running the command delete on files AND folders.
On files it’s no problem but on folders it must be deltree instead.

But I guess theres not a lot of person utilizing smb for external storage.

Mvh
Håkan Björk

Sorry, modify should work. Do you have any way of testing that SMB share with the same credentials from another computer to verify that you can delete folders from there? Are you sure there’s not a problem with the inheritance?

Hi!

I’m using 11.0.2 + External storage with Samba shares on other Linux servers and deletion of folders works fine there.

Best,
Alen

Try add this line in your /etc/fstab file.it works on my (win10+Hyperv+Ubuntu16.04+Php7+Nextcloud11.0)

//YOURMOUNTPOINT_IP/Nextcloud /var/www/nextcloud/data cifs uid=33,gid=33,rw,suid,username=YOURID,password=YOURPASSWORD,file_mode=0770,dir_mode=0770,noperm 0 0

I had similar issues (but with Ubuntu server) and found that PHP 7.1 remedied these weird issues with SMB on Windows

Hum_Billy, I can see that that will work better but since I don’t want to mount it in linux that’s no way to go but thank you for your answer.

stratacast: I will try that, as we are running PHP 7.0 today. Thank you for your answer.

Today I upgraded PHP to 7.1 but the issue is still here.

This is the error message I get in the log:

{“reqId”:“SwXBIJJuEAuQPhswk7t1”,“remoteAddr”:“213.179.0.115”,“app”:“PHP”,“message”:“fopen(/var/www/cloud-data/qdadmin/files_trashbin/files/Hi.txt.d1490618760): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Files/Storage/Local.php#287”,“level”:3,“time”:“2017-03-27T12:46:00+00:00”,“method”:“DELETE”,“url”:"/remote.php/webdav/Projekt/QD/Tripping/Hi.txt",“user”:“qdadmin”,“version”:“11.0.2.7”}
{“reqId”:“SwXBIJJuEAuQPhswk7t1”,“remoteAddr”:“213.179.0.115”,“app”:“PHP”,“message”:“fclose() expects parameter 1 to be resource, boolean given at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php#747”,“level”:3,“time”:“2017-03-27T12:46:00+00:00”,“method”:“DELETE”,“url”:"/remote.php/webdav/Projekt/QD/Tripping/Hi.txt",“user”:“qdadmin”,“version”:“11.0.2.7”}
{“reqId”:“1PS4oRt3ZG9OTQtr7q63”,“remoteAddr”:“213.179.0.115”,“app”:“PHP”,“message”:“fopen(/var/www/cloud-data/qdadmin/files_trashbin/files/Cant_do.txt.d1490618760): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Files/Storage/Local.php#287”,“level”:3,“time”:“2017-03-27T12:46:00+00:00”,“method”:“DELETE”,“url”:"/remote.php/webdav/Projekt/QD/Tripping/Cant_do.txt",“user”:“qdadmin”,“version”:“11.0.2.7”}
{“reqId”:“1PS4oRt3ZG9OTQtr7q63”,“remoteAddr”:“213.179.0.115”,“app”:“PHP”,“message”:“fclose() expects parameter 1 to be resource, boolean given at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php#747”,“level”:3,“time”:“2017-03-27T12:46:00+00:00”,“method”:“DELETE”,“url”:"/remote.php/webdav/Projekt/QD/Tripping/Cant_do.txt",“user”:“qdadmin”,“version”:“11.0.2.7”}
{“reqId”:“D0YXJ8IeoqlXDwU4Ty2A”,“remoteAddr”:“213.179.0.115”,“app”:“PHP”,“message”:“Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) at /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#91”,“level”:3,“time”:“2017-03-27T12:46:07+00:00”,“method”:“DELETE”,“url”:"/remote.php/webdav/Projekt/QD/Tripping",“user”:“qdadmin”,“version”:“11.0.2.7”}
{“reqId”:“RggsRofigLqrRVWID1MM”,“remoteAddr”:“213.179.0.115”,“app”:“PHP”,“message”:“Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) at /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#91”,“level”:3,“time”:“2017-03-27T12:48:56+00:00”,“method”:“DELETE”,“url”:"/remote.php/webdav/Projekt/QD/Tripping",“user”:“qdadmin”,“version”:“11.0.2.7”}

The two files IN the folder could be deleted but not the folder before or after the files where deleted. It’s talking about permissions in the error:
“failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Files/Storage/Local.php#287"”

What can that be about? What permission? NTFS?

I solwed it by mounting it in the linux server instead but now I get an error message in the web when I delete the folder:
“Error deleting file” but the folder gets deleted.