Nextcloud datafolder permissions

Hi

— sorry for my english :slight_smile:

That premission can be ok. Because the script set it too.
Did you set ownership like: chown -R www-data:www-data data/ ?

So you can set the premisson like “grouchysysadmin” written.

chmod 0750 /your/data/directory/ -> ( 7|5|0 mean => user: rwx | group: rx | other: - )
w = write / r=read / x=execute / - = no premissions

In your case: chmod 0750 /home/www-data/nextcloud_data/
maybe you have to set the same premission to every subdirectory.
find /home/www-data/nextcloud_data/ -type d -print0 | xargs -0 chmod 0750
And every file in the data folder
find /home/www-data/nextcloud_data/ -type f -print0 | xargs -0 chmod 0640
-> exept: .htaccess
chown root:www-data .htaccess
chmod 0644 .htaccess
to check: ls -la -> should get like: -rw-r–r-- root www-data .htaccess


It could be, that you have to set another config into the config.php:

  • Path: /var/www/nextcloud/config/config.php
  • Edit: ‘datadirectory’ => ‘/home/www-data/nextcloud_data/’,

scan all files to base: sudo -u www-data php -f /var/www/html/nextcloud/console.php files:scan --all


or with cron: crontab -e -u www-data
file scan 04:00 AM:
( * 4 * * * php -f /var/www/html/nextcloud/console.php files:scan --all ) -> without '( )'
cronjob for nextcloud - every 15 minutes:
( */15 * * * * php -f /var/www/html/nextcloud/cron.php ) -> without ‘( )’

Hope that can help

3 Likes