How to disable permission checking to data folder

Ask all your questions regarding OC 7.x Please read the Support Forum Rules
Forum rules
ownCloud 7.x will be end of life soon. See maintenance and release schedule for more details.

Time to upgrade!

Before you post; make sure you are using at least PHP Version 5.3.x - Also read Support Forum - Read this before posting
Posts: 1
Joined: Thu Nov 27, 2014 12:39 pm
Webserver: Apache
Database: MySQL
OS: Mac OS X Desktop

How to disable permission checking to data folder

Postby krzysiekj » Thu Nov 27, 2014 12:57 pm

"Data directory (/Volumes/Data/OwnCloud) is readable by other users
Please change the permissions to 0770 so that the directory cannot be listed by other users."

How to disable permission checking and let OwnCloud work with this "unsafe" environment.

I'm using bitnami stack to run OwnCloud on Max Os X Yosemite. My data directory is on encrypted drive (truecrypt) and exFAT partission so it is not possible to get mentioned settings.

Posts: 1
Joined: Thu Dec 25, 2014 3:29 pm
ownCloud version: 7.0.2
Webserver: Apache
Database: MySQL
OS: Windows Desktop
PHP version: 5.5+

Re: How to disable permission checking to data folder

Postby freepizza » Thu Dec 25, 2014 3:36 pm

On ubuntu 14 in /var/www/owncloud

sudo -s
grep "readable by other" `find . -name '*.php'`

gave e the offending file which was ./lib/private/util.php

open the file and go to the function that has the statement - "readable by other users"

Where the return code says - "return $errors"
replace with "return 0"

so mine looks like this:-
/*return $errors;*/
return 0;

The hack works for now.

Posts: 11
Joined: Fri Jan 02, 2015 7:24 am
ownCloud version: 7.0.3
Webserver: Apache
Database: SQLite
OS: Linux
PHP version: 5.5
Location: Nebraska, USA

Re: How to disable permission checking to data folder

Postby prutledge22 » Sun Jan 18, 2015 3:20 am

Not sure if what you were going for was to disable the notification or actually change the behavior. I needed to change the behavior so I could allow Plex to access (read-only) the media files I have in OC, but the 770 permission wouldn't allow that, and OC kept overwriting my efforts to chmod the data directory. After much looking around the interwebs, freepizza led me to the file that detects an incorrect permission setting on the data directory and changes it back to 770. You can edit the php file: owncloud/lib/private/util.php and change a couple bits so that instead of checking to see that the permission is 770, you can set it to make sure it is set to 775 (which is what I want).

Find the function "checkDataDirectoryPermissions" and edit the following three lines (they are not in a row, but in the same short block of code):

Code: Select all

if (substr($perms, -1) != '0') {
chmod($dataDirectory, 0770);
if (substr($perms, 2, 1) != '0') {

Since I want the permission of the data directory to be 775, I changed the 0 in the first and third lines to 5. The script is reading the permission number, and comparing the last digit to whatever is in single quotes (originally zero). By changing it to 5, it now won't see 775 as a problem. Then, of course, change the second line to 0775, so that if there ever is a change, it will revert it back to 0775. Your three lines should now be this (if you're trying to accomplish what I am):

Code: Select all

if (substr($perms, -1) != '5') {
chmod($dataDirectory, 0775);
if (substr($perms, 2, 1) != '5') {

Keep in mind that if an update to the OC software comes and changes this file, the hack is broken and you will have to go back in and fix it. You might want to write down your custom configuration changes so you can refer back to them later.

Also make sure you are aware of the security risks of opening any of this up other than what is supported by the software.

  • Similar Topics
    Last post

Return to “ownCloud Community Edition 7.x”

Who is online

Users browsing this forum: No registered users and 0 guests