Your data directory error

Owncloud hosted on our server suddenly started showing this error after we made some system changes recently. This issue has been brought up a few times before in the forums, but those discussions appeared to have not resulted in a resolution or identification of a working solution. Anyone who went through the same issue and if you were able to identify a solution, please share. Thanks.

" Your Data directory is invalid. Please check that the data directory contains a file ".ocdata" in its root.
Your Data directory is not writable by ownCloud

Permissions can usually be fixed by <a href="" target="_blank" rel="noreferrer">giving the webserver write access to the root directory</a>."

Have you tried reverting your system changes and seeing whether that fixes the issue?

Please paste the file permissions for your data directory. ls -alZ

There is a template for server topics, not sure why you neglected to use it, but in order to help you effectively we need the information you would have provided by filling it out.

1 Like

Thanks for your reply. We followed the said procedure mentioned by OwnCloud and also in alignment with our overall system. We just upgraded the OS and migrated the same framework to a faster drive partition in the same system. Otherwise, everything was done as per suggested installation method and was fully functional before.

Note: As a follow up to this message, I also shared the following with a couple of mentioned individuals at owncloud further elaborating the issue by email, which touched upon what you had asked in this message

Let me start with the file permissions within the data folder:
root@lamp-1-dns-1:################ ls -alZ
total 4
drwxrwx— 1 root root ? 32 Aug 5 22:12 .
drwxr-xr-x 1 web15 client2 ? 516 Aug 5 22:38 …
-rw-r–r-- 1 root www-data ? 542 Aug 5 21:55 .htaccess
-rw-r–r-- 1 root root ? 0 Aug 5 22:12 .ocdata

Please note that I also ran the bash script given on the Owncloud site to optimize the permissions list, which was also captured in my email.

Email sent to the OwnCloud support team after posting this message:

Hello OwnCloud Team:
This message is with regard to a couple of errors that I am seeing on the Owncloud landing page. We have had this installation for some time and started seeing this error after our recent upgrade in OS, and migration to a new drive.

We also tried to address the issue by confirming the presence of .ocdata and also ran a bash script to add right permissions aligning with the two error messages. Even after making these changes, we don’t see the error getting fixed. I also tried to share the same issue over through the Owncloud forum, and have not received any response over there.

Changing permissions: (Output from Bash script)
root@lamp-1-dns-1:####### ./
Do you want to secure your .htaccess files post installing/upgrade (y/N)? y
Securing .htaccess files with chmod/chown

Bash script Reference:
/installation/installation_wizard.html#data-directory-location on the OwnCloud site

I would also like to add that Nextcloud, which is similar to Owncloud is fully functional on our server after the switch.

If you happen to have any suggestions in this regard, please let me know.

@enebauer: When it comes to template, not sure what you meant by that. Please share the link and I will follow that template for server topics in the future.

Isn’t this wrong for the data dir?

1 Like


i think as well that the permissions are wrong because other users then “root” or users within the “root” group are not allowed to access the data dir because of the current permissions.

i think it is not directly related to your issue but still want to ask this:

Is ownCloud located at the same filesystem path?

If not additional problems could be originating from a changed path because ownCloud needs special modifications if the data directory was moved:

1 Like

@alfredb & @tom42: thanks.
It was the default permissions for the data directory. This permission also aligns with what I have for Nextcloud, which runs on the same server and tld. That one is fully functional.

So, what I did was the following, which helped to address the previous issues, but has led to a new issue, namely a blank white screen.

Steps taken:
First, renamed the old data directory to backup and created a new data directory and a new .ocdata file. Creating these two addressed the .ocdata issue, but not the second one.

So, I followed the instructions from a connected link that tom42 shared and ran a bash script, which led to a blank screen. If there is a blank php screen, this usually pertains to permissions, specifically for the config based on handling other php files in the past. However, I am unable to still locate the primary cause for this issue. Any thoughts on this one.

Permission bash script that was run:


Sets permissions of the owncloud instance for updating

chown -R {htuser}:{htgroup} ${ocpath}



before running any scripts randomly i think you need to first find out as which user the ownCloud installation is running. e.g. a previously post of you is mentioning “web15” as a user and “client2” as a group, if that’s the user and group but you’re changing the permissions to “www-data” then i think it is obviously that things will break :frowning_face:

thanks, tom42. It was not done randomly, but it was done based on the manual.
web15 is mapped to the domain, through the configuration panel. So, those are one and the same. -> /var/www/clients/client2/web15/

The ocpath given points to this domain folder where the data folder is present.

Taking your suggestion, I changed the ocpath to the one on the right to see whether that makes a difference, and that did not help, which should be the case. I also verified the permissions with what I have for the Nextcloud folder, and those match too.

@tom42: thanks. Now, it is working.

To wrap up:
If others face the same issue pertaining to .ocdata and permissions error after migration, please do the following:

  1. Create a new data folder and .ocdata file with no content after backing up the old one to a new folder.
  2. Set the permissions using the procedure given here,

Sets permissions of the owncloud instance for updating


chown -R {htuser}:{htgroup} ${ocpath}

This resolves the issue.

Thanks @tom42 and the community.

1 Like

Sorry, i picked the wrong wording for “randomly” (not a native English speaker). I thought you just ran the script without checking first if the “htuser” and “htgroup” were correct :frowning:

Glad that setting the correct permissions solved your issue now :+1:

1 Like

No problem.

Our chat exchange certainly assisted to address the permissions error.

Best - :smiley:

1 Like