[SOLVED] Data folders and access rights


Dear Forum,

I need help to determine what are the correct access rights I should give to my web user (not www-data in my case) on;
* all "external storage" folders
* all "user data" folders

By the way, where are those "user data" folders located?

Thanks in advance for any help!


Have a look at this Skript that sets the right permissions.



Thanks Dmitry!

Actually, my server is running Plesk, which creates a different user for each "domain" it handles. These are not a DNS domain, but a kind of internal domains which I may have my DNS zone pointing at; a.k.a. a 2nd level routing.

Example: the DNS zone includes domain1 and subdomain1.
domain1 points at the server IP address xx.xx.xx.xx, with both C and A (mywebsite.com) fields.
subdomain1 points at the same address, with both C and A (sub.mywebsite.com) fields.
Within Plesk, I need to define a "domain" mywebsite.com and a subdomain "sub.mywebsite.com". The Internet dataflow is caught by Plesk which then routes it to the domain or the subdomain, according to the headers...

For main domains (and their respective) sub domains, Plesk uses different user names.

I've found that my OC user is "admin_webbca" (the name I've created when instantiating the subdomain) which belongs to the group "psacln". So neither of the variables are www-data related... :frowning:

I'll try to customize the script with the above values and will let you know of the outcome. By the way, I still have some questions:
* Where should I put this script? Is there any preferred folder or can I just put it under mywebsite.com/oc?
* Will the script handle my external storage folder (secondary drive mounted as /media/diskext where I've created a dedicated oc/data folder to receive all files, user data folders will probably not been used)?

Thanks again for your help (and your skills)!


Hi Dmitry,

I finally applied the script which ran fine. However, trying then to scan all new files added to my external storage (via rsync), I got plenty of errors:

> Scanning files for 4 users
> Starting scan for user 1 out of 4 (admin_live)
> Exception during scan: Undefined index: size

> #0 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(421): OCA\Files\Command\Scan->exceptionErrorHandler(8, 'Undefined index...', '/var/www/vhosts...', 421, Array)
> #1 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(382): OC\Files\Cache\Scanner->handleChildren('20. Clients et ...', true, 3, '10102', true, 1522221)
> #2 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '10102', true)
> #3 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '8172', true)
> #4 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '8135', true)
> #5 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '8126', true)
> #6 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(385): OC\Files\Cache\Scanner->scanChildren('20. Clients et ...', true, 3, '7703', true)
> #7 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Cache/Scanner.php(316): OC\Files\Cache\Scanner->scanChildren('', true, 3, '44', true)
> #8 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Files/Utils/Scanner.php(235): OC\Files\Cache\Scanner->scan('', true, 3)
> #9 /var/www/vhosts/bcasmart.com/httpdocs/oc/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/admin_live')
> #10 /var/www/vhosts/bcasmart.com/httpdocs/oc/apps/files/lib/Command/Scan.php(228): OCA\Files\Command\Scan->scanFiles('admin_live', '/admin_live', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
> #11 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/composer/symfony/console/Command/Command.php(262): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #12 /var/www/vhosts/bcasmart.com/httpdocs/oc/core/Command/Base.php(159): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #13 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/composer/symfony/console/Application.php(826): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #14 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/composer/symfony/console/Application.php(189): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #15 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/composer/symfony/console/Application.php(120): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #16 /var/www/vhosts/bcasmart.com/httpdocs/oc/lib/private/Console/Application.php(160): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #17 /var/www/vhosts/bcasmart.com/httpdocs/oc/console.php(106): OC\Console\Application->run()
> #18 /var/www/vhosts/bcasmart.com/httpdocs/oc/occ(11): require_once('/var/www/vhosts...')
> #19 {main}
> Starting scan for user 2 out of 4 (ccianchi)
> Starting scan for user 3 out of 4 (flhermitte)
> Starting scan for user 4 out of 4 (jlgarnier)
> Home storage for user jlgarnier not writable
> Make sure you're running the scan command only as the user the web server runs as

> +---------+-------+--------------+
> | Folders | Files | Elapsed time |
> +---------+-------+--------------+
> | 313     | 2093  | 00:00:05     |
> +---------+-------+--------------+

Does it ring any bell to you?

Thanks in advance for your advices!


Can you try this?

It solved a similar issue before.


Thanks Dmitry!

Unfortunately, I don't know anything about this GitHub stuff: should I download some patch, update some files manually? Moreover, the topic relates to SFTP mount, which is not the case with my system (local mount, no RSA keys)...

I'm so sad not being able to understand the error messages on my own...

Thanks again for your help!


You can try and edit this file


and comment out (put a "#" infront of the line)

the lines 224-226 (if you open the file with nano, you can simply put the line number before the file number and you get directly to the line. like this

nano +224 /var/www/owncloud/lib/private/Files/External/StorageConfig.php

and try the scan again.

If it don't work - just revert the changes, you are doing nothing permanent to your system.


Thanks for the tip!
I hope you were talking about those lines:

if(is_string($backendOptions[$key])) {
				$backendOptions[$key] = str_replace(["\n", "\r"], "", $backendOptions[$key]);

Unfortunately, I've got exactly the same errors messages...

However, it seems rather curious that OC does not provide any simple way to detect files that were added out of the application other than webdav, which is totally useless when you have a large bunch of files to transfer to the system.

In my case, I just want to "initialize" the system with roughly 38Gb of files, currently stored on a NAS. I can't obviously transfer such a large amount of files using webdav... :frowning:

Any other help will be greatly appreciated! Thanks again!


We do :wink: You would mount this as external file system into ownCloud and then a file scan is done and you can either leave it that way or copy it inside ownCloud afterwards. Not sure why you think WebDAV is not able to copy 38GB of files. It can do way more :wink:
You could also start with the ownCloud sync client and copy things into ownCloud that way. Depending if you like to migrate away from the NAS or like to stick with it.

Many options, all depends on your needs.


Thanks Hodyroff!

There may be a clue there: I've mounted the external storage BEFORE syncing it with the NAS. I'll try to delete the entry from OC dashboard and then recreate it to trigger the scan... It's a LOCAL external storage: will the scan be performed normally?

By the way, did you ever try to copy 38Gb via the webdav channel? It took me 3 days to upload only 12Gb, so I quit...
Sync client is useless too as it would force me to copy all file on my laptop first and then suffer from bandwidth reduction due to the background sync process... :frowning:

Thanks again for your help!


Hi all!

Case officially SOLVED! :slight_smile: The access rights and permissions have been updated, and the scan was launched once I also fixed the cron() engine (package mailutils was corrupted)!

All files available now, thanks to all of you for your help!

This forum rocks!