I'm trying to set ownCloud up on my Pi (following this). I've made a symbolic link from my data and config folders to a USB stick mounted at /media/cruzer_usb (as per the link), and everything works, except when I go to http://mypi/owncloud, I am told:

Can't write into config directory!

This can usually be fixed by giving the webserver write access to the config directory.

I take that to mean that www-data needs to have access to the folder, in which case, my webserver does have access to the config directory:

>sudo ls -l /var/www/html/owncloud

total 168
drwxr-xr-x 29 www-data www-data  4096 May 30 19:03 3rdparty
drwxr-xr-x 26 www-data www-data  4096 May 30 19:04 apps
-rw-r--r--  1 www-data www-data  8065 May 30 19:03 AUTHORS
lrwxrwxrwx  1 www-data www-data    24 May 30 19:16 config -> /media/cruzer_usb/config
-rw-r--r--  1 www-data www-data  3439 May 30 19:03 console.php
-rw-r--r--  1 www-data www-data 34520 May 30 19:03 COPYING-AGPL
drwxr-xr-x 16 www-data www-data  4096 May 30 19:04 core
-rw-r--r--  1 www-data www-data  5919 May 30 19:03 cron.php
lrwxrwxrwx  1 www-data www-data    22 May 30 19:15 data -> /media/cruzer_usb/data
-rw-r--r--  1 www-data www-data 32727 May 30 19:04 db_structure.xml
-rw-r--r--  1 www-data www-data   179 May 30 19:04 index.html
-rw-r--r--  1 www-data www-data  2026 May 30 19:04 index.php
drwxr-xr-x  3 www-data www-data  4096 May 30 19:03 l10n
drwxr-xr-x  5 www-data www-data  4096 May 30 19:04 lib
-rwxr-xr-x  1 www-data www-data   283 May 30 19:03 occ
drwxr-xr-x  2 www-data www-data  4096 May 30 19:03 ocs
drwxr-xr-x  2 www-data www-data  4096 May 30 19:04 ocs-provider
-rw-r--r--  1 www-data www-data  2969 May 30 19:04 public.php
-rw-r--r--  1 www-data www-data  4599 May 30 19:04 remote.php
drwxr-xr-x  5 www-data www-data  4096 May 30 19:04 resources
-rw-r--r--  1 www-data www-data    26 May 30 19:03 robots.txt
drwxr-xr-x 12 www-data www-data  4096 May 30 19:04 settings
-rw-r--r--  1 www-data www-data  1819 May 30 19:04 status.php
drwxr-xr-x  3 www-data www-data  4096 May 30 19:03 themes
drwxr-xr-x  7 www-data www-data  4096 May 30 19:04 updater
-rw-r--r--  1 www-data www-data   233 May 30 19:04 version.php

but, I keep on getting that message.

I'm out of ideas, and Googling around hasn't led me anywhere. Any help would be appreciated :)

  • 1
    If anyone sees this in the future - I fixed this by reinstalling OwnCloud (deleting the owncloud folder and database). Not the ideal solution, so not posting as an answer! :) Commented Jun 5, 2016 at 19:44

4 Answers 4


If you want to make your USB stick fully usable by Linux programs, you should really consider formatting it as EXT2/3/4 (whichever you prefer), or at least make an EXT2/3/4 partition on it. Relying on mount permissions (set in /etc/fstab) will not work in general case: mount sets the same permissions for all files on a volume, so a program which wants its config file to have special permissions or ownership will fail. Check the tutorial you're using and note that the external drive is formatted as EXT4 there.

It's not clear what your immediate problem is. I can see the symlinks (/var/www/html/owncloud/config and /var/www/html/owncloud/data) are owned by www-data, but it's not clear what is the ownership and permissions of their targets (/media/cruzer_usb/config and /media/cruzer_usb/data). If you do sudo mount, they are likely to be owned by root. But that doesn't really matter: even if you manage to craft permissions to make Owncloud happy, you'll soon see that PHP or Apache will complain. There's no way to make Linux programs work from an NTFS volume.


It looks like the link has the correct permissions, but not he directory beneath it. You should be able to solve this with

sudo chown www-data:www-data -R /media/cruzer_usb/config
  • Thanks, but I still get the Can't write into config directory! message. I've also confirmed the /cruzer_usb/media and config directories do have the right permissions: drwxrwx--- 1 www-data www-data 0 May 30 19:06 config and drwxrwx--- 1 www-data www-data 0 May 30 19:06 data. I can't see why it can't access the config directory!! :( Commented May 31, 2016 at 12:44
  • @ᔕᖺᘎᕊ: how is the device mounted?
    – Jacobm001
    Commented May 31, 2016 at 16:26
  • I did sudo mount /media/cruzer_usb and I have UUID=6CD28705D286D32E /media/cruzer_usb ntfs-3g auto,users,permissions 0 0 in /etc/fstab. Sorry if I'm not being clear... I'm a complete linux noob :/ Commented May 31, 2016 at 17:23
  • @ᔕᖺᘎᕊ: you need to set the umask -o umask=000
    – Jacobm001
    Commented May 31, 2016 at 17:33
  • Like this?: UUID=6CD28705D286D32E /media/cruzer_usb ntfs-3g auto,users,permissions 0 0,umask=000, if so, that doesn't work :( (I tried rebooting as well) Commented May 31, 2016 at 17:52

Try turning selinux from Enforcing to Permissive with:

sudo setenforce 0

If this works for you, then you can set it permanent by editing:

sudo vi /etc/selinux/config

and then change




and reboot

  • 1
    Not to say that this is wrong, but I don't see any reference to selinux in the question. Commented Mar 1, 2017 at 10:24

I had the same write problem, but with a folder (apps). Yesterday I`ve did some modifications to my VM (OS Centos 7), and one of them was activation of SELinux. So in the /etc/selinux/config I have the follwing:


The permissions to the folder where ok. Knowingly that a day before yesterday all worked ok, and the SELinux policy was disabled figured that problem was caused by SELinux. The problem was solved after changing the manage file context mapping definitions without changing any of the SELinux config policys.

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/nextcloud(/.*)?"
restorecon -R /var/www/html/nextcloud

 $ ls -lZ | grep nextcloud
drwxr-x---. apache apache system_u:object_r:httpd_sys_rw_content_t:s0 nextcloud

You don`t need a reboot after. All back to normal now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.