Puphpet smb folder sync w/ Windows 8.1 Host

I’m attempting set-up a puphpet vm on Surface Pro 3 w/ Windows 8 and have ran into several road blocks along the way (not surprising). Anyhow most of those road blocks have been related to using smb (Samba) sync file type. I’ve managed google myself into solutions for most of them. However, I have now hit an issue where I can’t seem to find a solution to. I’ve managed to successfully stand-up the vm with vagrant w/ Samba syncing but upon provisioning an error occurs relating to writing to the synced folder directory /var/www. It seems like the Puphpet_apache module doesn’t have the proper permissions to write to that directory given and is exiting with a none zero exit status. The exact error originating from Puphpet_apache is below.

default: Notice: /Stage[main]/Puphpet_apache/Exec[Create apache webroot]/returns: chown changing ownership of ‘/var/www’: Permission Denied
default: Error: mkdir -p /var/www && touch root:www-data /var/www && chmod 775 /var/www && touch /.puphpet-stuff/apache-webroot-created returned 1 instead of [0].

One thing I found suggested to modify the Puphpet vagrant file to force permissions for the smb file type as shown below.

config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: 'smb', group: sync_group, owner: sync_owner, smb_host: smb__host, smb_username: smb__username, smb_password: smb__password, :mount_options=> ['file_mode=774', 'dir_mode=775']

However, that had no affect.

I also tried to modify the guest /etc/samba/smb.conf file as shown below.

[www]
path = /var/www/
public = yes
writable = yes
comment = smb share
printable = no
guest ok = yes
create mode = 0644
directory mode = 0755
force group = www-data
force user = www-data

Neither did that have any affect.

Does anyone know to prevent apache from erroring out during provisioning when attempting to change the permissions of the /var/www directories when using smb sync file type on a windows 8.1 host?

I did some digging and what I learned is that Windows Samba is not compatible with the standard linux permissions commands such as; chown, chmod, etc. Windows Samba uses an ACL which is significantly different. Any directories shared via Samba can only be changed via the ACL commands NOT chown or chmod. However, the Puphpet_apache module ALWAYS runs standard chown, and chmod commands to change ownership. Which will always result in a none zero exit status. However, the only reason that module changes permissions is so that apache is able to read and write to directories since they are likely owned by vagrant. The way around this for local development ONLY is to set the smb owner and group to vagrant as well as the apache owner and group to vagrant. That way apache will run as vagrant allowing read and write access to web directories on vm. The one caveat about this is that provioning the vm is always going to end up exiting none zero so you when change things you need to kind of be diligent about reading the errors an handle any that aren’t related to the Puphpet_apache module.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.