Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Samba force create/directory mode/mask not replicating in file system

  1. #1
    Join Date
    Jun 2008
    Beans
    1

    Samba force create/directory mode/mask not replicating in file system

    Hi All

    I'm having an issue with Samba where despite having tried various file permissions permutations such as:

    Code:
    create mask = 0660
    directory mask = 0770
    force create mode = 0660
    force directory mode = 0770
    - or -

    Code:
    create mask = 0660
    force create mode = 0
    security mask = 0770
    force security mode = 0
    directory mask = 0770
    force directory mode = 0
    directory security mask = 0770
    force directory security mode = 0
    every directory and every file which is created in my server file system, by means of samba, has file permissions 755. I have googled-around for this issue and searched various forums but none of the suggestions I've found as yet have worked.

    I've attached my smb.conf below. Thank you in advance of any suggestions.

    Code:
    [global]
       force group = sambashare
       workgroup = WORKGROUP
       netbios name = lancelot
       server string = %h server (Samba, Ubuntu)
       dns proxy = no
       log file = /var/log/samba/log.%m
       max log size = 1000
       syslog = 0
       security = user
       encrypt passwords = true
       passdb backend = tdbsam
       obey pam restrictions = yes
       invalid users = root
       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 = bad user
       socket options = TCP_NODELAY
       usershare allow guests = yes
    
    #option a
    ;   create mask = 0660
    ;   directory mask = 0770
    ;   force create mode = 0660
    ;   force directory mode = 0770
    
    [homes]
       comment = Home Directories
       browseable = yes
       writeable = yes   
       valid users = cai
    
    [permissions-test]
       comment = Comedy
       path = /disk300-a/Comedy
       browseable = yes
       writeable = yes
       guest ok = no
    
    # mask is the limit
    # mode is the actual value to use  
    
    #option b 
       create mask = 0660
       directory mask = 0770
       force create mode = 0660
       force directory mode = 0770
    
    #option c
    ;   create mask = 0660
    ;   force create mode = 0
    ;   security mask = 0770
    ;   force security mode = 0
    ;   directory mask = 0770
    ;   force directory mode = 0
    ;   directory security mask = 0770
    ;   force directory security mode = 0

  2. #2
    Join Date
    Dec 2006
    Location
    Calgary, Canada
    Beans
    110
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Samba force create/directory mode/mask not replicating in file system

    I have this same problem. Anyone have much luck finding a solution yet?

  3. #3
    Join Date
    Jul 2008
    Beans
    1

    Unhappy Re: Samba force create/directory mode/mask not replicating in file system

    The same problem... no solution so far?

  4. #4
    Join Date
    Dec 2006
    Location
    Calgary, Canada
    Beans
    110
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Samba force create/directory mode/mask not replicating in file system

    I found the solution. The key is that the masks are logically ORed with things. You need to RTFM unfortunately. Though it only takes a few mins.
    Code:
    man smb.conf

  5. #5
    Join Date
    Jan 2006
    Beans
    2,031

    Re: Samba force create/directory mode/mask not replicating in file system

    Here's what I use on my server, might be of more help then the above post:
    Code:
    [MyShare]
      comment = Read only share except for authorized users
      path = /mydata/mystuff/
      public = no
      guest ok = no
      read only = yes
      create mask = 0644
      directory mask = 0755
      force group = mygroup
      write list = myname, @mygroup

  6. #6
    Join Date
    Sep 2009
    Beans
    2

    Re: Samba force create/directory mode/mask not replicating in file system

    ignore that worthless RTFM suggestion.
    try thisin /etc/samba/smb.conf:

    unix extensions = no


    works on Hardy LTS with Samba 3.0.28a

  7. #7
    Join Date
    Dec 2006
    Location
    Calgary, Canada
    Beans
    110
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Samba force create/directory mode/mask not replicating in file system

    Quote Originally Posted by nivl4 View Post
    ignore that worthless RTFM suggestion.
    try thisin /etc/samba/smb.conf:

    unix extensions = no


    works on Hardy LTS with Samba 3.0.28a
    Lol, indeed - while that may well be a great solution.. If you're barely using the power of Samba and want to circumvent all sorts of functionality.

    If anyone on my team ever rejected to the validity of RTFM, I'd seriously reconsider the quality of their judgments. And possibly replace them with a very small shell script.

    If you get things working by Guess & Check, you're sort of asking for pain. Though if you're just screwin around at home, as long as you have a good backup, I guess have at 'er... And maybe this is a lesson that every one just has to learn for themselves.

    Blah, have fun everyone. If disabling "unix extensions" doesn't seem to hack it for you, once again, you can always read the documentation on how to use the thing you're working with. Or just blow-up in a puff of smoke & tears.

  8. #8
    Join Date
    Mar 2006
    Beans
    11

    Re: Samba force create/directory mode/mask not replicating in file system

    Quote Originally Posted by jamessnell View Post
    Lol, indeed - while that may well be a great solution.. If you're barely using the power of Samba and want to circumvent all sorts of functionality.

    If anyone on my team ever rejected to the validity of RTFM, I'd seriously reconsider the quality of their judgments. And possibly replace them with a very small shell script.

    If you get things working by Guess & Check, you're sort of asking for pain. Though if you're just screwin around at home, as long as you have a good backup, I guess have at 'er... And maybe this is a lesson that every one just has to learn for themselves.

    Blah, have fun everyone. If disabling "unix extensions" doesn't seem to hack it for you, once again, you can always read the documentation on how to use the thing you're working with. Or just blow-up in a puff of smoke & tears.
    Well, your RTFM suggestion kinda neglected to see the simple fact that according to the M in RTFM, the OP's config should work. For those of us with the same issue (seemingly correct configuration but unexpected file creation behaviour) it is not a very helpful suggestion.

    In fact, I'm using a share config that worked fine under 8.10, unfortunately I'm not sure if the samba version changed or if it's something else.

    In my case, unlike the OP, what seems to be happening is that my read bits for the group and everyone permission are getting masked out.

    After tearing my hair out I realised that this problem only affected one application: firefox. On closer inspection (like the OP I was making random changes to the share config) I found that samba behaved exactly as I would expect it to, provided I wasn't downloading via firefox.

    So my suggestion would be to try different methods of moving files and see if you get different behaviour.

  9. #9
    Join Date
    Dec 2006
    Location
    Calgary, Canada
    Beans
    110
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Samba force create/directory mode/mask not replicating in file system

    Weird, I wonder if it's possible there were remotely significant changes to the manual in one of the more recent revisions?

    I kind of doubt it.

    Well, anyway, I read the manual until I found what I needed. I applied what I found and the issue I had appeared resolved after a reasonable wedge of testing.

    At the end of the day that was now a long time ago, so I can't really contend anything as I usually solve problems, bookmark what I did (or document it otherwise) and move on. So I don't remember the details anymore, just that I was banging my head against the wall until I ran man samba.

    Anyway, I'm glad to hear you resolved your problem too.

  10. #10
    Join Date
    Mar 2006
    Beans
    1

    Thumbs down Re: Samba force create/directory mode/mask not replicating in file system

    I don't understand why setting unix extensions = no would help in this case. In the manual it explicit says that these extensions are of no current use to Windows clients. So it shouldn't matter what you set this to.

    What may actually help (which it did for me) is to validate the smb.conf file by running testparm
    Code:
    testparm -v /etc/samba/smb.conf
    In my case I found that some map settings made problems:
    Code:
    [work]
      comment = workfiles
      path = /storage/work
    #  map archive = yes
    #  map hidden = yes
    #  map system = yes
      inherit permissions = yes
      create mode = 0664
      directory mode = 0775
      valid users = @asd
      writable = yes
    The map archive, hidden and system maps these file attributes to the execute bit. Then it doesn't matter if the create mode tries to mask away the execute bit.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •