Can't create or write into the data directory with Ubuntu16.04

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 13.04
Operating system and version (eg, Ubuntu 16.04): Ubuntu 16.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.33
PHP version (eg, 7.1): 7.2

The issue you are facing:

Can’t create or write into the data directory

Is this the first time you’ve seen this error? (Y/N): No

Steps to replicate it:

  1. Open a web browser
  2. Input the directory for data storage and MySQL information
  3. Click “Create” button and ends with the error.

The output of your Nextcloud log in Admin > Logging:

Not successfully installed yet, so  no information about this part.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'ocag7dohrdna',

The output of your Apache system log in /var/log/____:

[Wed Jul 18 09:41:16.559642 2018] [core:crit] [pid 22479:tid 140667476989696] (1
3)Permission denied: [client] AH00529: /data/www/nextcloud/.hta
ccess pcfg_openfile: unable to check htaccess file, ensure it is readable and th
at '/data/www/nextcloud/' is executable

*** So here is what I tried ***

  • ls -l /data/www/nextcloud

-rwxr-xr-x 1 apache apache 362 Jun 11 08:25 version.php
Ever tried chown -R www-data:www-data /data/www/nextcloud and get worse
ls -l /data/www/nextcloud/data
drwxrwxrwx 2 www-data www-data 4096 Jul 18 09:52 data

  • open_basedir, already comment it out in php.ini

  • SELinux, it’s shut off