[Solved] Can't create or write into the data directory


Error that according to an FAQ post is caused mainly by missing permission for www-data. I tried a directory under /home/username as well as a directory in root. In both cases sudo -u www-data ls -la /path/to/folder returned files and folders instead of permission denied but the web initial set up still gave the same error.

I did not like the warning in admin settings about .htaccess and data being accessible from the internet, spent a few headache inducing hours trying to change the data folder directory until the web interface allowed to log in again appearing to function properly but for some reason uploading was broken throwing up a small forbidden pop up. At this point I just did a sudo apt-get purge owncloud-files also rm -r for a couple of directories under /var/www/owncloud that did not get deleted by the purge command as well as the other data directory outside of /var ,then reinstalled owncloud and tried to use the initial set up with a custom directory leading to the mentioned error.

Depending on how painful troubleshooting this is I might not care about getting the data directory outside of the webserver path and just use the defaults that I know to work.

Server configuration

Fresh Ubuntu server 16.04 LTS with default LAMP stack. Plus whatever changes made according to install documentation.

ownCloud version: 10 something

Updated from an older ownCloud or fresh install: fresh-ish

Where did you install ownCloud from: package manager using sudo apt-get owncloud-files after adding the repository with echo 'deb http://download.owncloud.org/download/repositories/production/Ubuntu_16.04/ /' > /etc/apt/sources.list.d/owncloud.list

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: what? probably no, idk my head hurts

Client configuration

Browser: Vivaldi, tried Chrome too

Operating system: Windows 8.1


If there are any idk where to look for them using command line nor how to get a copy on my desktop.


Solved my problem. Seems to me like sudo -u www-data ls -la /path/to/folder is not a reliable method for checking whether www-data is allowed to write into a directory.
Looked through the manual page of chown (man chown) and tried one of the examples for changing ownership of my /owncloud data directory, chown -hR root /u Change the owner of /u and subfiles to “root”. So sudo chown -hR www-data /owncloud in my case. After doing this I was no longer getting the data directory error.

Ran into another odd problem. There are old users left over that apparently don’t get deleted by purging owncloud-files, so it would be nice to find out where those are stored, the mysql database perhaps?
New users are able to upload files while the old leftover ones appear to have that forbidden error pop up. Deleting the old ones and recreating them worked out fine.