change data directory Owncloud


If you want to change the directory where the data UPLOADED to Owncloud (the data you want accessible like a “cloud”) it has not to be a subdirectory of the document root of your server, where ONLY directories and files for the functionality of Owncloud ITSELF should be, the /var/www directory.

User data has no place inside /var/www, otherwise it is accessible from the Internet with a simple “list” of the served files .

Normally, during the initial setup wizard, run from the browser, you have the option to set the path to the data directory.

chown -R www-data:www-data to that dir

Even if you miss it, you can always change afterwards, by setting the “datadirectory” directive in the config.php file of the Owncloud installation. Like this:

$CONFIG = array (
  'datadirectory' => '/media/usbdisk/ocdata/',
  'dbtype' => ...

You can find more on the topic inside this forum post.

As a note of caution, it is always important to have the LEAST possible amount of data available through the wire. You can look here for some very good points about document root permissions.