Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home storage not writable #25755

Closed
schnello opened this issue Aug 10, 2016 · 41 comments
Closed

home storage not writable #25755

schnello opened this issue Aug 10, 2016 · 41 comments

Comments

@schnello
Copy link

Steps to reproduce

  1. Start file scan with ooc sudo -u www-data php occ files:scan --all

Expected behaviour

No error message.

Actual behaviour

For some user i got an error message:

root@uplink:/var/www/owncloud# sudo -u www-data php occ files:scan --all

Scanning files for 5 users
Starting scan for user 1 out of 5 (Bianca)
Home storage for user Bianca not writable
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 2 out of 5 (Christian)
Starting scan for user 3 out of 5 (Nico)
Home storage for user Nico not writable
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 4 out of 5 (Sissy)
Starting scan for user 5 out of 5 (TESTUSER)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 9013    | 33447 | 00:04:38     |
+---------+-------+--------------+

Server configuration

Operating system: Ubuntu 16.04

Web server: Apache/2.4.18 (Ubuntu)

Database: mysql Ver 14.14 Distrib 5.7.13, for Linux (x86_64) using EditLine wrapper

PHP version: PHP 7.0.8-0ubuntu0.16.04.2

ownCloud version: 9.1.0 stable
**Updated from an older ownCloud or fresh install: updated from 8.x

Where did you install ownCloud from: Ubuntu Repro

Signing status (ownCloud 9.0 and above):

No errors have been found.

List of activated apps:

root@uplink:/var/www/owncloud# sudo -u www-data php occ app:list
Enabled:
  - activity: 2.3.2
  - comments: 0.3.0
  - dav: 0.2.5
  - federatedfilesharing: 0.3.0
  - files: 1.5.1
  - files_external: 0.6.0
  - files_pdfviewer: 0.8.1
  - files_sharing: 0.10.0
  - files_texteditor: 2.1
  - files_trashbin: 0.9.0
  - files_versions: 1.3.0
  - files_videoplayer: 0.9.8
  - firstrunwizard: 1.1
  - gallery: 15.0.0
  - notifications: 0.3.0
  - provisioning_api: 0.5.0
  - systemtags: 0.3.0
  - templateeditor: 0.1
  - updatenotification: 0.2.1
Disabled:
  - encryption
  - external
  - federation
  - files_antivirus
  - notes
  - passwords
  - registration
  - user_external
  - user_ldap

The content of config/config.php:

root@uplink:/var/www/owncloud# sudo -u www-data php occ config:list system
{
    "system": {
        "instanceid": "ocs19kglaiqz",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.1.210",
            "uplink.spdns.eu"
        ],
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "https:\/\/uxxxxxxxxxxu\/",
        "dbtype": "mysql",
        "version": "9.1.0.15",
        "logtimezone": "Europe\/Vienna",
        "installed": true,
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "sxxxxxxxxxr.cs",
        "mail_smtpmode": "sendmail",
        "mail_domain": "gmail.com",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "maintenance": false,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "smtp.gmail.com",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls",
        "loglevel": 2,
        "appstore.experimental.enabled": true,
        "updatechecker": false,
        "theme": "",
        "data-fingerprint": "d5e948xxxxxxxxxxxxxxxx018b695"
    }
}

Are you using external storage, if yes which one: local/smb/sftp/...
Yes: 1 external hosted owncloud share

Are you using encryption: yes/no
No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
No

Client configuration

**Browser: Chrome

**Operating system:
Win10

Logs

ownCloud log (data/owncloud.log)

no entry in the log during file scan

additional note:

I checked the files permission and i see no difference between user Christian und Bianca

@PVince81
Copy link
Contributor

Ok thanks for the details.

Will have to find out where in the code this error is displayed to understand how the permissions check is done.

@PVince81
Copy link
Contributor

It seems the message is triggered by any ForbiddenException, not only permission issues, so maybe for these users something is triggering that exception for a different reason.

Can you add this line:

            $output->writeln('<error>Exception while scanning: ' . $e->getMessage() . "\n" . $e->getTraceAsString() . '</error>');

below this row https://github.com/owncloud/core/blob/v9.1.0/apps/files/lib/Command/Scan.php#L158 ?

@schnello
Copy link
Author

I added the line below Scan.php#L158 and run the scan again:
New error message is:


root@uplink:/var/www/owncloud# sudo -u www-data php occ files:scan --all

Scanning files for 5 users
Starting scan for user 1 out of 5 (Bianca)
Home storage for user Bianca not writable
Exception while scanning:
#0 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(155): OC\Files\Utils\Scanner->scan('/Bianca')
#1 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(224): OCA\Files\Command\Scan->scanFiles('Bianca', '/Bianca', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /media/500_1/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /media/500_1/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /media/500_1/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /media/500_1/owncloud/console.php(94): OC\Console\Application->run()
#9 /media/500_1/owncloud/occ(11): require_once('/media/500_1/ow...')
#10 {main}
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 2 out of 5 (Christian)
Starting scan for user 3 out of 5 (Nico)
Home storage for user Nico not writable
Exception while scanning:
#0 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(155): OC\Files\Utils\Scanner->scan('/Nico')
#1 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(224): OCA\Files\Command\Scan->scanFiles('Nico', '/Nico', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /media/500_1/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /media/500_1/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /media/500_1/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /media/500_1/owncloud/console.php(94): OC\Console\Application->run()
#9 /media/500_1/owncloud/occ(11): require_once('/media/500_1/ow...')
#10 {main}
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 4 out of 5 (Sissy)
Starting scan for user 5 out of 5 (TESTUSER)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 9013    | 33447 | 00:04:38     |
+---------+-------+--------------+
root@uplink:/var/www/owncloud#

@PVince81
Copy link
Contributor

I suspect that this is the one you're getting: https://github.com/owncloud/core/blob/v9.1.0/lib/private/Files/Utils/Scanner.php#L166

But if you say that the permissions are all correct and the web server user is allowed to write everywhere in the data folder, then it should be fine.

You might want to do a chown -R wwwrun:www data/ (replace username and group accordingly) just to be sure permissions are the same everywhere.

@schnello
Copy link
Author

You might want to do a chown -R wwwrun:www data/ (replace username and group accordingly) just to be sure permissions are the same everywhere.

Done but the error message remains
Please see also http://uplink.spdns.eu/file_report.log
I think the permissions are correct.

@PVince81
Copy link
Contributor

Hmmm indeed, they look correct. So maybe PHP is having trouble correctly checking for creatability.

@schnello
Copy link
Author

schnello commented Aug 10, 2016

Strange...
If i remove all shared files for Nico... it works

root@uplink:/media/500_1/owncloud# sudo -u www-data php occ files:scan --path=Nico
Starting scan for user 1 out of 1 (Nico)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 23      | 38    | 00:00:00     |
+---------+-------+--------------+
root@uplink:/media/500_1/owncloud#

If i share a file with Nico... the error reappears

root@uplink:/media/500_1/owncloud# sudo -u www-data php occ files:scan --path=Nico
Starting scan for user 1 out of 1 (Nico)
Home storage for user Nico not writable
Exception while scanning:
#0 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(155): OC\Files\Utils\Scanner->scan('/Nico')
#1 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(224): OCA\Files\Command\Scan->scanFiles('Nico', '/Nico', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /media/500_1/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /media/500_1/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /media/500_1/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /media/500_1/owncloud/console.php(94): OC\Console\Application->run()
#9 /media/500_1/owncloud/occ(11): require_once('/media/500_1/ow...')
#10 {main}
Make sure you're running the scan command only as the user the web server runs as

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 23      | 38    | 00:00:00     |
+---------+-------+--------------+
root@uplink:/media/500_1/owncloud#

@PVince81
Copy link
Contributor

Okay, that's an interesting clue. So the ForbiddenException might be happening when it finds the shared storage. I wonder if it's somehow related to the bogus shared storage entries #24106

I'll see if I can reproduce this somehow locally.

@Thomanji
Copy link

Hi,
I get the same after applying the patch from ticket 25506.
However, it looks it only happenes for users that

sudo -u apache php occ files:scan --all

Starting scan for user 3 out of 12 (bernhard)
Home storage for user bernhard not writable
Make sure you're running the scan command only as the user the web server runs as

Happens only for some users. Here is what I found out.

I checked the users and these are users that belong to a group to which a folter is shared too . I have a group called "Education", everyone that was assigned to this group had the error. I removed the share for this group and it works without problem now.
However, as soon I activate the share to the group back, the issue happens again for the users that are assigned to this group. If I share to a user direct, all works fine. So only seems to happen if shared to groups.

Best wishes,
Thomas

@PVince81
Copy link
Contributor

@Thomanji thanks for the details, I'll see if I can reproduce the issue locally with a similar sharing scenario

@PVince81
Copy link
Contributor

Hmm, I couldn't reproduce the issue.

My steps:

  1. Create three users "user1", "user2" and "user3", all in the group "group1"
  2. As admin, create a folder "test"
  3. Upload some files
  4. Share "test" with "group1"
  5. occ files:scan --all

Regardless whether the share is read-write or read-only, the scan goes through without errors.

@Thomanji is the EDUCATION folder shared read-only ?

@schnello
Copy link
Author

@PVince81
This is my way to get the error:

All actions are done in the webinterface:

  1. Create TEST1 User wihtout group
  2. Create TEST2 User without group
  3. Login to TEST1 and i create a new txt file.
  4. I share the new file with TEST2 (can share, can modify)
  5. I login to the TEST2 User to verify the file is shared.
  6. I run the file scan...
root@uplink:/var/www/owncloud# sudo -u www-data php occ files:scan -p TEST2
5Starting scan for user 1 out of 1 (TEST2)
Home storage for user TEST2 not writable
Exception while scanning:
#0 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(155): OC\Files\Utils\Scanner->scan('/TEST2')
#1 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(224): OCA\Files\Command\Scan->scanFiles('TEST2', '/TEST2', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /media/500_1/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /media/500_1/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /media/500_1/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /media/500_1/owncloud/console.php(94): OC\Console\Application->run()
#9 /media/500_1/owncloud/occ(11): require_once('/media/500_1/ow...')
#10 {main}
Make sure you're running the scan command only as the user the web server runs as

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 7       | 7     | 00:00:00     |
+---------+-------+--------------+
root@uplink:/var/www/owncloud# 5

@PVince81
Copy link
Contributor

@schnello thanks, now I got it. Could be because it's a file, not a folder.

@schnello
Copy link
Author

schnello commented Aug 17, 2016

The problem is:
Some files works... some not. The same with folders. Some folders are ok to share... some not.

@PVince81
Copy link
Contributor

Okay, I found that the problem is already fixed on the stable9.1 branch, through 6f4ba32 (from PR #25675)

You might be able to apply the commit as patch: https://github.com/owncloud/core/commit/6f4ba321613ddf406fa0fcbb1228e89ca35e8425.patch

@Thomanji
Copy link

OK, sorry but there is a followup.
I just did go ahead and shared this to 3 users direct and got the same error on 2 of them. Than I checked and I see that the 2 users that it happened to, did not have "Edit" rights. As soon I shitch on the edit rights the error for the 2 users goes away. Same for the "education" group. if I share with "edit" rights all is fine. If edit rights are off the error happens.

I am going to apply the patch and see.
Thank you very much @PVince81 for the help.

@schnello
Copy link
Author

schnello commented Aug 17, 2016

Thanks @PVince81

I was not able to apply the patch but it works fine if i add the lines manually.

root@uplink:/var/www/owncloud# sudo -u www-data php occ files:scan --all

Scanning files for 8 users
Starting scan for user 1 out of 8 (Bianca)
Starting scan for user 2 out of 8 (Christian)
Starting scan for user 3 out of 8 (Nico)
Starting scan for user 4 out of 8 (Sissy)
Starting scan for user 5 out of 8 (TEST1)
Starting scan for user 6 out of 8 (TEST2)
Starting scan for user 7 out of 8 (TESTUSER)
Starting scan for user 8 out of 8 (TESTUSER2)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 9196    | 34047 | 00:06:06     |
+---------+-------+--------------+

@PVince81
Copy link
Contributor

Great to hear. Yeah, I had a conflict too locally.

@Thomanji
Copy link

Yes, solved it for me too.
Patch did not apply but after adding the patch manually to apps/files_sharing/lib/sharedstorage.php all seems to work.

Before:
sudo -u apache php occ files:scan bernhard
Starting scan for user 1 out of 1 (bernhard)
Home storage for user bernhard not writable
Make sure you're running the scan command only as the user the web server runs as
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 112 | 176 | 00:00:06 |
+---------+-------+--------------+

After patch:
sudo -u apache php occ files:scan bernhard
Starting scan for user 1 out of 1 (bernhard)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 112 | 176 | 00:04:54 |
+---------+-------+--------------+

@foux
Copy link

foux commented Jul 3, 2017

Sorry to re-open this, but I've got the exact same error on ownCloud 10 with, of course, the patch already applied

@ownclouders
Copy link
Contributor

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

(This is an automated comment from GitMate.io.)

@PVince81 PVince81 reopened this Jan 22, 2018
@PVince81 PVince81 modified the milestones: 9.1.1, triage Jan 22, 2018
@enoch85
Copy link
Member

enoch85 commented Feb 3, 2018

Same issue for me on 10.0.4. @rvdmeij's soulution solved it.

@marina-mosti
Copy link

Same issue on 10.0.4. Tried @rvdmeij's solution:

php occ user:sync "OC\User\Database"
If unknown users are found, what do you want to do with their accounts? (removing the account will also remove its data)
Analyse unknown users ...
   37 [============================]

>No unknown users have been detected.
>Insert new and update existing users ...
> 37/37 [============================] 100%

Still getting the same output on file:scan --all and on the specific user

Starting scan for user 27 out of 37 (melissa)
Home storage for user melissa not writable
Make sure you're running the scan command only as the user the web server runs as

@pasdVn
Copy link

pasdVn commented Mar 15, 2018

I had the same issue with NC 13. I guess the problem was the following for me:
I created user A and mounted an external storage (local) to / before the user logged in the first time. Obviously in this case the 'files' directory under /A/ is not added in this case (probably 'A' is added on first login!?).

For 'debugging' this issue I temporary removed the external storage at '/' of user A with the result, that I could not login at all (execption...; the log says something like "OCP\Files\NotFoundException: /var/www/nextcloud/apps/files/lib/Controller/ViewController.php - line 131: OC_Helper getStorageInfo('/', false)" etc.). I added this folder manually then and re-mounted the external storage to '/' and afterwards the scan worked for me.

@PeterWVV
Copy link

Hello,

I wish to reactivate this bug… I have 9 users (out of 33) that have the same problem :
Starting scan for user 30 out of 33 (admin)
Home storage for user admin not writable

Using owncloud 10.0.9.

The only solution I've found is to delete the user and recreate it : a new sync starts again, but that is long and complicated !!

Any other solution ?

Thanks

Peter

@happicamper
Copy link

Experiencing this issue too after moving the /data directory.
Tried my luck by using @rvdmeij solution but it seems doesn't work.

@fwm64
Copy link

fwm64 commented Oct 16, 2018

Same thing here after moving /data after upgrade to 10.0.10. But, i found that the users in the oc_account table never logged in and additional the last login time stamp is set as zero there. In a second step i proof the users home and there it doesn't exist the files dir described like above.
Following works for me:

  1. Make the "files" dir in the usershome-data
  2. chown : usershome-data/files
  3. rescan the files for the user, like descriped in the posts above.

Check, all is running for me.

@Tomduril
Copy link

Tomduril commented Nov 19, 2018

I just had the same issue.
Owncloud 10.0.10.

I fixed it after some hints (which I will now describe to maybe help others).
I had some users in an owncloud 9.0.x and decided to go for a new installation.
I recreated all existing users (only 3) manually and then changed the data directory in the config/config.php file.

The scan did not work :-(
Some users had the problem with "home directory not writeable", but for all users the existing files were found, not scanned and therefore not visible in owncloud.

The issue was that the home directory of the user is stored in the database (mariadb in my case)!
Changing the data directory (in the config.php) after the user were created had no effect on their home directory in the database.

I manually updated the database by changing the values for the users in the table "oc_accounts" column "home" and then the scan worked!

Good luck to everyone haveing troubles with this issue!

@Nolyb
Copy link

Nolyb commented Jan 10, 2019

I just had the same issue.
Owncloud 10.0.10.

I fixed it after some hints (which I will now describe to maybe help others).
I had some users in an owncloud 9.0.x and decided to go for a new installation.
I recreated all existing users (only 3) manually and then changed the data directory in the config/config.php file.

The scan did not work :-(
Some users had the problem with "home directory not writeable", but for all users the existing files were found, not scanned and therefore not visible in owncloud.

The issue was that the home directory of the user is stored in the database (mariadb in my case)!
Changing the data directory (in the config.php) after the user were created had no effect on their home directory in the database.

I manually updated the database by changing the values for the users in the table "oc_accounts" column "home" and then the scan worked!

Good luck to everyone haveing troubles with this issue!

This worked for us. We didn't even move our data directory and new files would write to random directories within the data dir. Upon checking the home column in the oc_accounts table, we found that it had assigned random characters as the user directories within the data directory. I corrected them all, scanned, and had users login. Worked like a charm!

@mehargags
Copy link

mehargags commented Aug 2, 2020

OwnCloud Version 10.4.1.3 dated Apr-2020

#25755 (comment)
This worked for me too... was struggling after migrating an OC 10.0 instance to a new server where the "paths" changed. The PHP-fpm's CPU would go 80-90% when trying to login as super admin and the owncloud.log would go crazy 1GB in 30 seconds.

Struggled for an hour or so and stumbled upon the cli scan
sudo -u docs php7.3 occ files:scan --all
which gave me Home storage for user xxx not writable while all necessary file permissions were correct. So digging into database table oc_accounts I saw the user's path was from the old server. Fixed path directly in DB and voila !!! all works smooth.

Hope this helps anyone else migrating their OCs.

Also it would be great to rather have "relative" path stored in the DB per user rather than an absolute path. That's what exactly the constant 'datadirectory' in config is for. The relative path in DB should be derived from 'datadirectory'+user's directory. Jut my 2 cents

Regards.

@skironDotNet
Copy link

If you moved the data folder, please check oc_accounts, it has a home folder column and might require updating.

This is golden, just surprised migration can't handle owncloud-docker/server#357 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests