mount over samba not allowing www-data to write - permission denied but empty file created

4.2k Views Asked by At

Got one recent Ubuntu 12.04 box talking to another. Running Samba 3.6.3.

Server box has a samba share called "root" that maps to / The smb.conf has 0777 as just about every parameter!

[root]
    writeable = yes
    create mode = 0777
    create mask = 0777
    force create mode = 0777
    path = /
    directory mode = 0777
    force directory mode = 0777
    read only = no

If I have the following in fstab and then do a mount -a, it does a mount, and as root I can read and write just fine:

//slf.mybiz.net/root /mnt/slf smbfs username=asambauser,password=apassword 0 0

However, if I do a su www-data on the client (trying to mimic an Apache/PHP server) I get the following error sequence:

$ cd /mnt/slf
$ ls -la
total 24
drwxrwxrwx  23 root users    0 Dec  9 17:02 .
(rest deleted, as I presume it's the permissions of . that are important)
$ echo g > ddd
sh: 1: cannot create ddd: Permission denied

(although the odd thing is that a 0 byte file is created)

I didn't think there was any clever business over the Samba link of who the user is. Certainly if I umount /mnt/slf, I can write to /mnt/slf as www-data.

Tearing what little hair I have out over this one!!!

1

There are 1 best solutions below

0
On

Eventually found someone with the same problem:

https://unix.stackexchange.com/questions/92168/samba-share-permission-denied-user-writing-file-but-still-shows

And adding "defaults,noperm" to the mount command fixed the problem for me