Sebus
Sebus

Reputation: 3892

Apache can't modify/create files in network share

I use Ubuntu 13.10 Server in a Virtualbox on a Windows 7 Hostsytem. My code is mounted from Windows to /var/www

//192.168.1.2/code_share /var/www cifs username=USERNAME,password=PASSWORD,uid=1000,iocharset=utf8,uid=1000,gid=1000,file_mode=0777,dir_mode=0777 0 0

Then I installed symfony in /var/www/project with composer and when I try to access my Symfony-Page, I get this:

IOException: Failed to chmod file "/var/www/project/app/cache/dev/appDevDebugProjectContainer.xml".

Why is it for apache not possible to access this folder?

Upvotes: 0

Views: 289

Answers (1)

WebHQ
WebHQ

Reputation: 711

Apache cannot change mode (privileges) of files when files are owned by some other user (dev

on your box). You must change UID and GID to apache's. By the way remove double uid option from your mount command.

Apache UID = 33 ; GID = 33

//192.168.1.2/code_share /var/www cifs username=USERNAME,password=PASSWORD,iocharset=utf8,uid=33,gid=33,file_mode=0777,dir_mode=0777 0 0

EDIT

  1. Apache UID

    $ cat /etc/passwd | grep www-data | awk 'BEGIN { FS=":" } END { print $3 }'

  2. Apache GID

    $ cat /etc/group | grep www-data | awk 'BEGIN { FS=":" } END { print $3 }'

Upvotes: 1

Related Questions