What are the best permissions for the Nextcloud data folder? Mine is 700 for www-data:www-data. -> Read write execute for Webserver User other users donât have permission to read etc.
Hi
Please be carefule with your premissions
to check that your data safe: https://cloud.DOMAIN.com/apps/files/
you should became an error 403
please check this out: https://docs.nextcloud.com/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions
you can copie the text into a script.sh file and run it with bash script.sh -> That script set all right premission that you need
Hope that can help
Yeah. I have run this Skript before. But my Nextcloud root is under /var/www/nextcloud and the data folder is under /home/www-data/nextcloud_data and I just copied the data folder because my server was down for just some time and I had to recover the server. But I didnât want to loose my data. So I just removed the old folder and replaced with the new one. But I got a few strange errors like Your server is not connected to the internet and I couldnât upload files. There was a âForbiddenâ message. So I just chowned the nextcloud data folder recursively to www-data:www-data. But the permissions were not right I think. Thanks for your comments.
Hi
â sorry for my english â
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
Thanks very much for your answer. Iâve set it like this now. and I do get a 403.
Good afternoon everybody.
I use this post because is similar to my question but can be changed if you feel it for a new one.
First question:
-
is it just me that can not find the âSetting strong directory permissionsâ on admin installation manual versions higher of 9.0 or it is nested somewhere else? Iâve checked the 11, 11.0, 12, 12.0 versions with no success.
-
if this is not listed anymore does it means it is wrong/obsolete/ not required anymore?
-
I have the data directory on a NAS which I mount on the linux server as follow:
âdrwxr-xâ 2 www-data www-data 0 Jul 21 22:07 next/â accordingly to the directory permission suggestion find on 9.0 admin guide. I do not use the External storage app. Do you know if and how I can change owner and permissions to the .htaccess file in the next/ directory?
Thanks a lot
I run:
ubuntu 16.4
nextcloud 12.0.0
@gipsea you are right on nr 2 - we donât recommend setting these permissions as it has caused more issues than it increases security. If an attacker can replace files with the rights of the web server, youâre in big trouble anyway.
I suggest to stick to default permissions. Nextcloud will automatically set them to â600â upon running the update script.