Can read but cannot write to Samba share

67,567

After hours of searching, I discovered that the share name and the share directory cannot be the same (and it's not case-sensitive, either). See this post on serverfault.

So, if I change my share name in smb.conf from:

[Music]

to

[Tunes]

I can both read and write to the share. No other changes to my smb.conf were necessary, and no need to chmod 0777.

Share:
67,567

Related videos on Youtube

the_meter413
Author by

the_meter413

I'm into music, tinkering with my Saab(s), climbing mountains, fixing old houses, and letting the smoke out of electronic devices.

Updated on September 18, 2022

Comments

  • the_meter413
    the_meter413 over 1 year

    I'm trying to set up a Samba share that is only accessible by a particular user. I'd like that user to have read/write access to all files in the share.

    The smb.conf file below will let me access the share through the one user 'patrick' but I can't get write access to work - I cannot modify or delete files on the mounted share via windows. The user does have the proper permissions set for the directory per below.

    How can I enable read/write access? I do not want to change the directory/file permissions to 0777 like many of the other forum posts would suggest.

    Directory permissions:

    drwxr-xr-x   6 patrick patrick  4096 Jul  3  2015 ./
    drwxr-xr-x   3 root    root     4096 Jul  1  2015 ../
    drwxrwxr-x+ 15 patrick patrick 65536 Jan 22 00:01 music/
    

    The smb.conf file:

    [global]
       workgroup = WORKGROUP
            server string = %h server (Samba, Ubuntu)
    
    #   wins support = no
       dns proxy = no
       log file = /var/log/samba/log.%m
       max log size = 1000
       syslog = 0
       panic action = /usr/share/samba/panic-action %d
       server role = standalone server
       passdb backend = tdbsam
       obey pam restrictions = yes
       unix password sync = yes
       passwd program = /usr/bin/passwd %u
       passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
       pam password change = yes
       map to guest = never
    
       usershare allow guests = no
    
    [Music]
       comment = Music on Ceres
       path = /mnt/largemarge/music
       valid users = patrick
       browseable = yes
       guest ok = no
       read only = no
       create mask = 0775
       directory mask = 0755
       force user = patrick
    
  • the_meter413
    the_meter413 over 8 years
    Can anyone find where the above constraint is documented in the samba man pages? I was unable to find it.
  • Marc Vanhoomissen
    Marc Vanhoomissen over 8 years
    I doubt this is a constraint: on my system, all defined shares (with different access rights) have Share name = Directory name. Exemples: [ze] writeable = yes path = /partages/ze I guess it is rather a limitation on specific directories.
  • Charles Green
    Charles Green almost 7 years
    Is there any added information in this answer, that was not covered in the answer from Jan 24 2016?
  • Gorgsenegger
    Gorgsenegger almost 3 years
    That doesn't work for me.
  • Branton Davis
    Branton Davis over 2 years
    Thank you so much. I had a slightly different scenario, but this fixed it for me. Say I had a share named foo and the path was /home/user/me/foo/share, I could never write to the share from a Windows. Changing the share name to not match the parent directory and restarting did the trick!
  • muhammad tayyab
    muhammad tayyab over 2 years
    Doesn't work. I had to change file ownership to get the write permission.