Some sub-Folders on SMB/CIFS External Storage are read only. (You don't have permissions to upload or create files here.)
notes:
this happens both as user with pass-through, or as admin in admin settings.
both users have Full Control on the destination disk and share, also one user is owner of entire folder
(re-applied permissions).
both users can edit the entire share as expected with other clients - like windows explorer or ubuntu unity.
tried ./occ files:scan --all it completes, but did not help.
Steps to reproduce
- create new connection from OwnCloud to an existing SMB share (External Storage)
- when browsing SMB storage with WebUI some sub-folders are read only. these display "You don't have permissions to upload or create files here." but in these 'Read Only' folders, the sub-folders continue to work as expected.
- syncning with Client shows error - "not allowed because you don't have permission to add files in that folder", but can sync sub-folders of these.
Expected behavior
Folder and its contents should be changeable by user
Actual behavior
user can't edit contents of some folders, user can read contents, user can edit sub-folders of these read only folders. user receives; "You don't have permissions to upload or create files here." or "not allowed because you don't have permission to add files in that folder"
Server configuration
Operating system: Ubuntu 14.04 Web server: Apache 2.4.7 Database: MySQL 5.6 PHP version: PHP 7 ownCloud version: (see ownCloud admin page) 9.0.2 Updated from an older ownCloud or fresh install: update or fresh Where did you install ownCloud from: Ubuntu repo Signing status (ownCloud 9.0 and above):
http://example.com/index.php/settings/integrity/failed
No errors have been found.
List of activated apps:
Enabled:
- activity: 2.2.1
- agreedisclaimer: 1.0.0
- comments: 0.2
- dav: 0.1.6
- documents: 0.12.0
- external: 1.2
- federatedfilesharing: 0.1.0
- federation: 0.0.4
- files: 1.4.4
- files_external: 0.5.2
- files_mv: 0.8.2
- files_pdfviewer: 0.8.1
- files_reader: 0.7.1
- files_sharing: 0.9.1
- files_texteditor: 2.1
- files_trashbin: 0.8.0
- files_versions: 1.2.0
- files_videoplayer: 0.9.8
- gallery: 14.5.0
- music: 0.3.11
- notifications: 0.2.3
- provisioning_api: 0.4.1
- systemtags: 0.2
- templateeditor: 0.1
- updatenotification: 0.1.0
The content of config/config.php:
"instanceid": "ocxxx15",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"sync2.xxx.com",
"sync.xxx.com"
],
"datadirectory": "\/mnt\/SYNC-data\/own-data",
"overwrite.cli.url": "https:\/\/sync2.xxx.com:4443",
"dbtype": "mysql",
"dbname": "OC-XXX",
"dbhost": "127.0.0.1",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"version": "9.0.2.2",
"logtimezone": "America\/New_York",
"loglevel": 0,
"memcache.local": "\\OC\\Memcache\\Redis",
"filelocking.enabled": "true",
"memcache.distributed": "\\OC\\Memcache\\Redis",
"memcache.locking": "\\OC\\Memcache\\Redis",
"ldapIgnoreNamingRules": false,
"appstore.experimental.enabled": true,
"preview_libreoffice_path": "\/usr\/bin\/libreoffice",
"knowledgebaseenabled": false,
"check_for_working_htaccess": true,
"check_for_working_webdav": true,
"has_internet_connection": true,
"filesystem_check_changes": 1,
"theme": "",
"maintenance": false,
"updatechecker": false
Are you using external storage, if yes which one: SFTP and SMB/CIFS
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Client configuration
Browser: Chrome, IE, Firefox (any) Operating system: Windows 7-10, 2008-2012. Ubuntu.
Logs
Web server error log
[Thu May 12 04:30:54.819769 2016] [mpm_prefork:notice] [pid 1184] AH00169: caught SIGTERM, shutting down
[Thu May 12 04:35:53.727423 2016] [ssl:warn] [pid 1177] AH01909: RSA certificate configured for owncloud:4443 does NOT include an ID which matches the server name
[Thu May 12 04:35:53.757048 2016] [ssl:warn] [pid 1177] AH01909: RSA certificate configured for owncloud:443 does NOT include an ID which matches the server name
[Thu May 12 04:35:57.320939 2016] [ssl:warn] [pid 1192] AH01909: RSA certificate configured for owncloud:4443 does NOT include an ID which matches the server name
[Thu May 12 04:35:57.321322 2016] [ssl:warn] [pid 1192] AH01909: RSA certificate configured for owncloud:443 does NOT include an ID which matches the server name
[Thu May 12 04:35:57.326638 2016] [mpm_prefork:notice] [pid 1192] AH00163: Apache/2.4.7 (Ubuntu) OpenSSL/1.0.1f configured -- resuming normal operations
[Thu May 12 04:35:57.326667 2016] [core:notice] [pid 1192] AH00094: Command line: '/usr/sbin/apache2'
ownCloud log (data/owncloud.log)
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/$RECYCLE.BIN' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:15-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/desktop.ini' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:15-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/Thumbs.db' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/$RECYCLE.BIN' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/desktop.ini' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/Thumbs.db' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/$RECYCLE.BIN' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/desktop.ini' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/Thumbs.db' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/$RECYCLE.BIN' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/desktop.ini' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"o2E8cO1yOX\/UbAoMgkyU","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/Thumbs.db' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"PROPFIND","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"XcFKByAxpG+lWz9Et2zD","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/$RECYCLE.BIN' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/getstoragestats.php?dir=%2FDocuments-SMB%2FDesktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"XcFKByAxpG+lWz9Et2zD","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/desktop.ini' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/getstoragestats.php?dir=%2FDocuments-SMB%2FDesktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"XcFKByAxpG+lWz9Et2zD","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/Thumbs.db' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:16-04:00","method":"GET","url":"\/index.php\/apps\/files\/ajax\/getstoragestats.php?dir=%2FDocuments-SMB%2FDesktop","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"7cj+MxzJYcZhWcZP6gbW","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/$RECYCLE.BIN' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:25-04:00","method":"MOVE","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop\/Prime95","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"7cj+MxzJYcZhWcZP6gbW","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/desktop.ini' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:25-04:00","method":"MOVE","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop\/Prime95","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"7cj+MxzJYcZhWcZP6gbW","remoteAddr":"4.1.14.103","app":"OC\\Files\\Cache\\Scanner","message":"!!! Path 'Desktop\/Thumbs.db' is not accessible or present !!!","level":0,"time":"2016-05-12T14:39:25-04:00","method":"MOVE","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop\/Prime95","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}
{"reqId":"7cj+MxzJYcZhWcZP6gbW","remoteAddr":"4.1.14.103","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 403 Forbidden\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\Forbidden\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(640): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\ObjectTree->move('Documents-SMB\\\/D...', 'Documents-SMB\\\/D...')\\n#1 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpMove(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(459): Sabre\\\\Event\\\\EventEmitter->emit('method:MOVE', Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(248): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#5 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(55): Sabre\\\\DAV\\\\Server->exec()\\n#6 \\\/var\\\/www\\\/owncloud\\\/remote.php(138): require_once('\\\/var\\\/www\\\/ownclo...')\\n#7 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/connector\\\/sabre\\\/objecttree.php\",\"Line\":218,\"User\":\"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507\"}","level":0,"time":"2016-05-12T14:39:25-04:00","method":"MOVE","url":"\/remote.php\/webdav\/Documents-SMB\/Desktop\/Prime95","user":"A7E378AE-43A2-47CB-9075-9F0FAE1964DB_7507"}




thank you for your time everyone
Ref owncloud/enterprise#1234
cc @PVince81 @icewind1991
Does the folder in question have read-only permissions ? There's this thing about Windows ignoring read-only permissions on folders, so people might expect that ownCloud behaves like Windows does.
I've double checked the NTFS permissions, and reset them recursively to Full Control. I also checked and reset Inheritance settings on those problem folders. Problem was not resolved.
I noticed this on our server a few days after I upgraded to 9.0.2. It was working OK on OwnCloud 9.0.1.
We have a SAMBA share called home which contains a folder for each user. I create an SMB/CIFS external storage connection in each account with a share name of home and a remote sub-folder of the account name. After upgrading to 9.0.2 the root of this external storage in every user's account shows the message "You don't have permission to upload or create files here".
Mapped drives to these folders on Windows clients are still read/write. An older web interface called WebDAV.cgi that uses smbclient still offers read/write access that works. Only OwnCloud 9.0.2 shows these folders as read-only.
OwnCloud 9.0.2 shows the sub-folders of these folders as read/write. I can also edit the contents of files in these read-only folders. I just can't upload new files or delete existing files. Uploading a file through OwnCloud via WebDAV gives a 403 forbidden error.
Hmmm, if it worked in 9.0.1 then this is a regression. @Orbital-Bit do you remember whether it worked correctly for you in 9.0.1 (if you ever had that version).
@PVince81 we went from 8.2.4 to 9.0.2. On OC 8 we had only one SMB External Storage connected, that share worked fine and that share still works fine. we noticed the problem when we added more shares to OC 9. only some of the newly added shares mis-behave in the manner described.
This is turning into a real problem for me. Can I downgrade from OwnCloud 9.0.2 to 9.0.1 safely?
I've double-checked the permissions on these folders on the Samba server. They are identical for each user. Each user has been assigned full control on their home folder. No permissions are assigned to sub-folders. The sub-folders only show the inherited permissions from the user's home folder.
Several users have working home folders in OwnCloud. The hidden permissions variable is 15 on their home folder and all of their sub-folders. As far as I can tell this number matches the full control permissions they have on the Windows share.
Most users have restricted permissions showing in OwnCloud, even though they have the same Windows permissions as the users whose home folders work correctly. The home folder itself shows permissions = 9. The first and second level folders under their home folder show permissions = 7. If they have a deeper folder structure than that, the folders show permissions = 15.
If I can't downgrade to 9.0.1 safely, is there an easy way I force permissions = 15 in OwnCloud? None of the shares I have setup in OwnCloud are read-only. If a user can access the share, they have read/write permissions to it, so the permissions set to 7 and 9 should never apply.
The part I find weird is that some of you say that 9.0.1 worked fine but 9.0.2 didn't, which means there's a regression.
@icewind1991 @jvillafanez can you help ?
We're using the 'DOS' permissions or the file attributes (not really sure what's the "official" name), basically whether the file is read-only or hidden.
@Orbital-Bit by your comments, I think you're using windows ACLs, which is a different mechanism.
In order to check the DOS permissions, you can open a windows console (in windows) and check file attributes with the "attrib" command, something like:
attrib C:\Your\path\to\file.txt
You can remove the read-only attribute using the following command (in windows - adapt the file name to your needs):
attrib -r C:\Your\path\to\file.txt
You can check more info in https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/attrib.mspx?mfr=true (it's for XP, but I don't think there are changes between versions regarding this topic)
I thought I was only using Windows ACLs on my Samba server. It turns out several directories had the DOS read-only attribute on them as well. I could only find them and change them from a Windows command prompt.
A recent change to OwnCloud seems to have started tracking the DOS attributes on files and directories, even though my Samba server seems to ignore the read-only attribute on directories. I tracked the relevant change back to apps/files_external/lib/smb.php and the addition of isReadable and isUpdatable between 9.0.0 and 9.0.1.
I recursively removed all of the read-only attributes from files and directories on my home share using the attrib command. That seems to have cleared up the problem for me, although I still don't understand how the read-only attribute is supposed to work with directories on Windows shares.
I've been hit with this as well over the last couple of weeks, it was only the last comment which pointed me in the right direction to fix it. In my case, none of my files were marked read only. However there were some hidden+system files (thumbs.db, desktop.ini) which seem to be causing a similar problem. These files were stopping me uploading new files to the whole of the folder.
After deleting these files, everything started working as expected.
@jvillafanez @icewind1991 is there anything that should be done on the OC side here ?
When we try to detect the changes in the backend, we could add the current (stored) permissions into the mix to decide whether the file / folder has changed. However this will very likely have performance implications. I think we need to check what storages can handle the extra load (if any) before starting.
@fiskn this was exactly the issue. Removing read-only attribute from those files resolves the issue.
@OCDevs These are pretty standard files in the windows world, and if they are read-only (or any single file in a directory) this should not trip up OwnCloud and turn the directory read-only.
thank you for your time.
These are pretty standard files in the windows world, and if they are read-only (or any single file in a directory) this should not trip up OwnCloud and turn the directory read-only.
@icewind1991 @jvillafanez hmm, why would the SMB code misinterpret permissions as read-only when only a single file inside a folder has read-only permissions ?
If the folder itself has read-only permissions, then is understandable that ownCloud considers it as read-only too.
If the folder itself has read-only permissions, then is understandable that ownCloud considers it as read-only too.
According to this KB https://support.microsoft.com/en-us/kb/326549 under the CAUSE section, the read-only attribute on a Windows folder does not mean that it should be considered read-only. To Windows it means that the folder had its view customized by Windows.
While I fixed my problem using the attrib command earlier, I actually shouldn't have. Removing the read-only attribute from those folders removed view customization my users set on them.
Argh... Ok, so I guess this means ownCloud and/or the SMB library should then ignore read-only permissions on folders.
According to this KB https://support.microsoft.com/en-us/kb/326549 under the CAUSE section, the read-only attribute on a Windows folder does not mean that it should be considered read-only. To Windows it means that the folder had its view customized by Windows.
:trollface: Windows... :trollface:
Has anyone tried the behaviour in other OS? I think samba (in linux) behaves properly, and I'm not sure about MacOS (I had issues with the signature and I couldn't try).
@jvillafanez i can confirm that modifying the view on a folder causes the issue in OwnCloud. (these settings are saved to a hidden file 'desktop.ini', and this file and the the directory Attributes are set to Read-Only.) and as previously confirmed using the command line to remove this setting from the folder resolves the issue. also can confirm that the folders work as expected in Ubuntu, Android and OS X (or is it MacOS now?)
so this issue is about a directory Attribute, not file or directory Security Permissions. Attributes and Permissions are separate settings a file and/or a directory can have. Read-Only Attribute should be ignored on directories (as apparently it was in version 9.0.1 and earlier).
thank you @alankeny @jvillafanez @fiskn
I mentioned earlier that I worked around this problem by removing the read-only attribute on the directories on my Samba server. For the most part that fixed the problem. A few users still can't see some of the folders that had been marked with the read-only attribute. Other users can see the folders even though they're on the same share.
I've tried using files:scan, but I can only get it to scan local files. I've tried:
occ files:scan --path username/files
and
occ files:scan --all
Since some users can see the folder and others can't, I assume this has to be related to some kind of caching for external storage. How can I force OwnCloud to refresh the folder contents of external storage for the users that are having problems?