Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. ![]()
The Basics
- Nextcloud Server version (e.g., 29.x.x):
34.0.3
- Operating system and version (e.g., Ubuntu 24.04):
Linux 6.12.47+rpt-rpi-v8 aarch64
- Web server and version (e.g, Apache 2.4.25):
Apache 2.4.68
- Reverse proxy and version _(e.g. nginx 1.27.2)
n.a.
- PHP version (e.g, 8.3):
8.3.17
- Is this the first time you’ve seen this error? (Yes / No):
yes
- When did this problem seem to first start?
after I moved config directory outside of web root
- Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
manual
- Are you using CloudfIare, mod_security, or similar? (Yes / No)
no
Summary of the issue you are facing:
I’m currently implementing server hardening steps and, following Hardening and security guidance — Nextcloud 35 Administration Manual , I’ve placed my config directory outside of the web root in /etc/nextcloud. Site is up and running, but I can’t set the config dir in the shell environment. The documentation gives this command:
export NEXTCLOUD_CONFIG_DIR=/etc/nextcloud
I have tried to run it as superuser (sudo -i) before running sudo -u www-data php occ commands.
I have added it to ~/.bashrc
I have added NEXTCLOUD_CONFIG_DIR=/etc/nextcloud to /etc/environment
All to no avail - I keep getting the error Cannot write into "config" directory!
I set folder permissions for /etc/nextcloud to 0750 and to 0640 for the files in it.
Steps to replicate it (hint: details matter!):
-
Move config folder from web root to
/etc/nextcloud -
Add
SetEnv NEXTCLOUD_CONFIG_DIR /etc/nextcloudto virtual host and reload apache2 service -
run
export NEXTCLOUD_CONFIG_DIR=/etc/nextcloudin shell -
run
sudo -u www-data php /var/www/html/nextcloud/occ status -
Recieve error
Cannot write into "config" directory!
Log entries
Nextcloud
Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.
n.a.
Web Browser
If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.
n.a.
Web server / Reverse Proxy
The output of your Apache/nginx/system log in /var/log/____:
n.a.
Configuration
Nextcloud
The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):
n.a.
Apps
The output of occ app:list (if possible).