-
Notifications
You must be signed in to change notification settings - Fork 2.4k
docs: add file permissions guidance to hardening page #14922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,6 +108,47 @@ Also set it for CLI work (``occ``, cron): | |
| .. seealso:: :doc:`../configuration_server/config_sample_php_parameters` for full details on | ||
| ``NEXTCLOUD_CONFIG_DIR`` and other configuration loading behaviour. | ||
|
|
||
| Set strong file permissions | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Strong file system permissions reduce the attack surface if an attacker gains | ||
| access to the web server process. The recommended baseline restricts world | ||
| access to the Nextcloud installation directory: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| # Set ownership to the web server user and group | ||
| sudo chown -R www-data:www-data /var/www/nextcloud/ | ||
|
|
||
| # Files: owner read/write, group read-only, no world access | ||
| sudo find /var/www/nextcloud/ -type f -print0 | sudo xargs -0 chmod 0640 | ||
|
|
||
| # Directories: owner full, group read+execute, no world access | ||
| sudo find /var/www/nextcloud/ -type d -print0 | sudo xargs -0 chmod 0750 | ||
|
|
||
| The **data directory** must remain writable by the web server user: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| sudo chown -R www-data:www-data /path/to/nextcloud-data/ | ||
|
|
||
| If you install or update apps via the Nextcloud **app store**, the ``apps/`` | ||
| directory also needs to be writable by the web server: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| sudo chown -R www-data:www-data /var/www/nextcloud/apps/ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already covered by the chown on |
||
|
|
||
| .. note:: | ||
|
|
||
| The built-in **web updater** requires write access to the entire Nextcloud | ||
| installation directory. If you apply stricter permissions that prevent | ||
| web server writes, the web updater will fail. Disable it first by adding the following to | ||
| ``config/config.php``, then use the command-line updater or package | ||
| manager instead:: | ||
|
Comment on lines
+144
to
+148
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But how to apply these stricter permissions? If the owner of the files is www-data and owner has read/write the webserver has write access. So is it with a chown to root? Joas seemed to say this is preventing all upgrades 🤔 |
||
|
|
||
| 'upgrade.disable-web' => true, | ||
|
|
||
| Disable preview image generation | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a chmod as well, no?