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

Add config option to bypass checkDataDirectoryPermissions #3245

Closed
jarofgreen opened this issue Jan 24, 2017 · 11 comments
Closed

Add config option to bypass checkDataDirectoryPermissions #3245

jarofgreen opened this issue Jan 24, 2017 · 11 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: install and update
Milestone

Comments

@jarofgreen
Copy link

jarofgreen commented Jan 24, 2017

During install Nextcloud checks the data directory has permission 0770 and won't let the install proceed without that.

It seems it might be good to allow this check to be skipped, in the same way that the admin can go to "Additional settings" and turn off the check for common passwords. (But this check should be on by default as is the other check.)

Skipping this has to be configured in config.php and not the admin panel; as you can't finish the install if this check fails you can't get to the admin panel! So you must be able to turn it off in config.php.

To add a feature to skip this check, replace this line:

 $errors = array_merge( $errors, self::checkDataDirectoryPermissions( $CONFIG_DATADIRECTORY ) );

in function checkServer in https://github.com/nextcloud/server/blob/master/lib/private/legacy/util.php#L699 (currently line number 699 and 718) with:

if ($config->getSystemValue('check_data_directory_permissions', true)) {
     $errors = array_merge( $errors, self::checkDataDirectoryPermissions( $CONFIG_DATADIRECTORY ) );
}

This will run the check by default, but then the admin can add

'check_data_directory_permissions' => false

to config.php to skip it.

Goggling "please change the permissions to 0770 so that the" shows this is a common problem, with some problems caused by people using external drives with a different file system - http://askubuntu.com/questions/380767/please-change-the-permissions-to-0770-so-that-the-directory Tho it is true some problems seem to be caused by things like bad FTP uploads and there you definitely want file permissions sorted out properly.

I personally ran into this problem as I was running Nextcloud in Vagrant for testing, and my Vagrant mount options meant I couldn't simply use chmod to fix the problem. So I took a deeper look at it.

EDIT: I originally suggested wthout dashes but this seems to have lead to confusion as with dashes is now the official way - added in dashes to try and avoid confusing others.

@MorrisJobke MorrisJobke added 0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: install and update labels Jan 25, 2017
@axelmm
Copy link

axelmm commented Aug 24, 2017

I ran into this problem and googled for this, too. IMHO this is much more than common problem (affects people for years), sometimes it's not resolvable making NC(OC) not installable 'by design' - in my case: Docker for Windows (v. 10 pro + Hyper-V) - permissions error - like many other ntfs, nfs, etc issues.

This proposal is a great idea - as a workaround I simply commented out only line #768 - but I would rather left chmod attempt and allow gently bypass failing result in checkDataDirectoryPermissions(), sth like this ( current line #980 ):

	if ($perms[2] !== '0') {
		$strictly = \OC::$server->getSystemConfig()->getValue('datadirectory.strictly.permissions', true);
		if (!$strictly) {
			return $errors;
		}
		$errors[] = [
			//..
	}

Only one place to change and as above - default behaviour not changed but can be simply modified when needed.

@tobru
Copy link
Contributor

tobru commented Oct 27, 2017

Let me add my vote here as we face issues with installing Nextcloud on OpenShift (see tobru/nextcloud-openshift#4). It's nearly impossible to change mount settings on OpenShift and in my opinion it should work out of the box. So if the directory permission checking can be made optionally by changing the configuration in the configuration file, that would be really great.

@alexander0042
Copy link

This would be a really amazing fix to implement- I run everything on a Windows server 2016 docker install, and this glitch stops everything. I've tried a few ways to change permissions on a volume, but it's definitely not possible. Especially since NextCloud is so storage intensive, I can't save it in the same Moby VM as docker is running in

@tilosp
Copy link
Member

tilosp commented Nov 10, 2017

This would make the docker image usable on Docker for Windows (nextcloud/docker#70).

@alexander0042
Copy link

Just in case anyone else is looking at this- a workaround is to make the volume within the MobyVM- it's still treated as a volume, so persists outside of containers, but because it's within the Linux filesystem there aren't the permissions issues.

However, definitely not an ideal fix, since this forces all the containers + data to be on the same VHD. In my case (probably not uncommon), I'd like to put the container on my SSD and the data on my HDD, but right now everything must be stored on the hard drive. It also introduces issues resizing the VHD if too much data is stored there.

@MorrisJobke
Copy link
Member

Fixed in #7347

@tangobravo5656
Copy link

'checkdatadirectorypermissions' => false,
I added this line to the /var/www/html/nextcloud/config/config.php . But the data folder(/mnt/zfs/share/nextcloud) still being automatically reset to 0770.And ACLs didn't work in my case maybe has something to do with my mounting method since i used 9P virtfs.

@tangobravo5656
Copy link

Fixed in #7347

Hi can u help me out?
'checkdatadirectorypermissions' => false,
I added this line to the /var/www/html/nextcloud/config/config.php . But the data folder(/mnt/zfs/share/nextcloud) still being automatically reset to 0770.And ACLs didn't work in my case maybe has something to do with my mounting method since i used 9P virtfs.

@Normand-Nadon
Copy link

@tangobravo5656 , if you did not find the answer, here it is:
It is not written the way you did (and many posts have reported on the web)... it has underscores!

'check_data_directory_permissions' => false,

Just found it myself after months with this issue on an Unraid server with shared drives!

@optimodzhu
Copy link

@tangobravo5656 , if you did not find the answer, here it is: It is not written the way you did (and many posts have reported on the web)... it has underscores!

'check_data_directory_permissions' => false,

Just found it myself after months with this issue on an Unraid server with shared drives!

Thank you very much!

@joshtrichards
Copy link
Member

For further context, the parameter details can be found in the official documentation:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#check-data-directory-permissions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: install and update
Projects
None yet
Development

No branches or pull requests

10 participants