I have bought WD myCloud storage and I have mount it to centos 7 by adding this line to fstab

\\wd_mycloud_ip_address\shared_folder /backup cifs rw,suid,username=shared_folder_username,password=shared_folder_password 0 0

after that i mount using

# mount -a

it works fine, and I am able to insert/create/delete files into the /backup which is mirrored into the WD storage Note that the directory /backup has chown root:root

the problem now when I want to let the apache (using php web application) itself save files into the mounted directory /backup , I am getting an error in my web application "The destination folder is not writable."

I tried diffrent senario to solve the issue but unfortuntly it dosen't works fine.

First I have umount the /backup, changed the

chown -R apache:apache /backup

, the web application is able to save the files. but the problem this only when I umount.

second, while the /backup is mounted with "chown root:root", I have tried to change it is owner/group to apache:apache but it doesn't allow. the commend goes without an error but when I "ls -al" it show me it is still root:root.

How can I mount a /backup directory using root:root and at the same time let the web application save files into /backup using apache:apache ?

  • Try to create a folder beneath /backup like /backup/apache and try to chown apache:apache /backup/apache and use that one. – Thomas Jul 27 at 11:01
  • @Thomas I have created new dir under /backup, and I have run chown -R /backup/apache still it not able to change to apache:apache .. when I run ls -al it shows root:root ... That means the mount affect all inner directories as well. – Jaifar Al Shizawi Jul 28 at 13:49
  • 1
    Given its CentOS the mount most probably has the wrong selinux security context. – Gerald Schneider Jul 28 at 20:05

I have added apache uid and gid to the mount statement and deleted suid as following

\wd_mycloud_ip_address\shared_folder /backup cifs rw,uid=apache_user_id,gid=apache_group_id,username=shared_folder_username,password=shared_folder_password 0 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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