Can't create or write into the data directory / Can't write into config directory! / Data directory (/mnt/data) is invalid



You’re getting one of the following error message:

  • Can’t create or write into the data directory
  • Can’t write into config directory!
  • Data directory (/mnt/data) is invalid (/mnt/data is an example here)


The messages basically means that ownCloud can’t access and write into the mentioned directories (as the messages are telling). There are a few issues which are showing up quite often:

Missing permissions

You have permission issues that the users which is running your webserver has no access to this folders. If you’re on e.g. Ubuntu/Debian this can be checked by running the following command:

sudo -u www-data ls -la /path/to/folder

this command should return a list of files / folders instead of a “Permission denied” message.

If the command is failing you need to make sure to setup the correct permission. How to setup the correct permissions needed are described here:


Within PHP it is possible to configure a open_basedir to restrict access of PHP to specific files and folders. If this setting doesn’t contain the folder where ownCloud needs to write into it will fail. Please see the PHP manual available here how to configure this correctly:


On systems running SELinux a correctly configured policy is needed. The ownCloud documentation available here provides basic infos for this:

If you need further help with SELinux please contact a support community dedicated to your used linux distro as SELinux is a quite complex topic.

Wrong mount permissions

If ownCloud itself or one of the mentioned directories are placed on an external hard disc which is mounted automatically or manually into your system it might be possible that the permissions where setup incorrectly during mount time. This happens especially if the external hard disc is formatted with e.g. NTFS.

It is important that the user running your webserver (e.g. www-data, apache or httpd) has full read and write permissions to that mount point. As giving linux basics are out of the scope of this forums please have a look at tutorials / answers like:


An example /etc/fstab line which might also work on your system could be:

// /mnt/owncloud cifs credentials=/home/username/.smbcredowncloud,rw,uid=33,gid=33,dir_mode=0770,iocharset=utf8,sec=ntlm 0 0

Can't create or write into the data directoy '/home/data/cloud'
Data Directory Error - Permissions Issue
Can't upload or create file
Impossible to add extra local storage to OC
Delete files on a NFS mount
[Solved] Can't create or write into the data directory
Can't create or write into the data directory
Restore Owncloud after data loss
External Drive Help
Permission folder config redhat
Unable to upload to external storage via the web
FAT32 Drives in OC 9.1.0 As External Storage
Can't get permissions right when data dir is mounted
Owncloud and google storage bucket
External Storage Redirect to Homepage
Upgrade 7.0 to 8.0 on shared host: permissions problem
Data directory (/data) is invalid
Cannot install to synology
Error can't create or write into the data directory
Permission error on data mount of 10.0.2 DOCKER
closed #2