I have a raspberry pi running Apache2, PHP5 and Samba on it (so I can access the pi from my home network as a network drive).

However, I have managed to change the apache2 running directory to /network-drive/website in order to be able to build a home website from that directory, which means I can just view the files in windows explorer from my laptop like any other folder.

The problem is, When I log into my pi with the user name mandy-samba, The PHP files it saves do not have execute permissions. When I try and access index.php, I get the following error:

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

However If I log in via SSH and run the following command:

sudo chmod -R 755 /network-drive/website

It works fine.

But if I edit the file from my laptop (aka, the mandy-samba user), I get the error.

How can I allow or set my mandy-samba user to write files with executable permissions?

1 Answer 1


You need to set the mask/s in your smb.conf and restart the samba daemon for the settings take effect.

user create mask = 0755 
directory mask = 0775
  • Ahh wow thank you, Yes I was wondering if it was something to do with the Samba config. I will try this as soon as I get home tonight! Thank you!
    – Chud37
    Mar 14, 2017 at 9:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .