Here's the relevant smb.conf section:

        path = /somewhere
        read only = No
        writeable = Yes
        guest ok = Yes
        create mask = 0777
        security mask = 0777
        directory mask = 0777
        force create mode = 0777
        directory security mask = 0777

Say user1 creates a directory on that share. It's permissions will be: drwxr-xr-x and the owner will be user1.

While user2 can access the directory created by user1, he receives a permission error when trying to create a file on that directory.

To me it seems weird that the permissions of the dir created by user1 aren't 777 as specified in smb.conf...

Edit: I forgot to mention a weird error that pops up in the client log when the permission is denied:

[2009/06/24 03:02:18,  0] smbd/trans2.c:unix_filetype(1130)
  unix_filetype: unknown filetype 0

What am I missing?


You're missing:

force directory mode = 0777

Also, you really want to use 0666 for force create mask. Probably no good reason to force the execute bits.

  • Yay, that solves the directory part. I removed all masks and I left only [force] create/directory modes to 0666 for create and 0777 for directory. However, files are being created with 0644. Any ideas why? – Ivan Jun 24 '09 at 23:46
  • I found it: force security mode ... I thought that setting was only supposed to work for Windows clients... – Ivan Jun 25 '09 at 0:43
  • Note that according to the man page of smb.conf, 'force security mode' has been removed for Samba 4.0.0. – dotnix Feb 23 '15 at 23:12
  • @dotnix Interesting, did they replace it with something? – derobert Feb 25 '15 at 4:04
  • @derobert: It has been replaced with 'force create mode'. Take a look at: git.samba.org/… – dotnix Feb 26 '15 at 19:50

Changing permissions to 777 ALWAYS makes me nervous, even if this is a home project. Instead, add all your samba users to a group (like samba_user), then in smb.conf add the line:

force group = samba_user

Naturally, you must also chgrp all the necessary folders as well. Then you can set finer grained permissions, allow people to do their thing in other people's folders, and your server isn't turned into a free for all. Someone wants to have a private folder? Just change that folder's group from samba_user back to the user's private group.


I'm guessing that this is the permissions in smb.conf being used as a mask along with those specified in the user's profile, the two will get anded together rather than ored so if samba says 777 and the user's mask is 755 then you'll get 755 as a result.

The permission denied message that you see is simply agreeing with the permissions that you are seeing recorded against the files. The extra error message you see I'm not sure about though.

  • I tried setting the user's umask to 0000 for testing purposes, and samba still gives those user's permission 0644. I also tried setting the umask for root (well, not really root, rather for the admin user in Ubuntu), to no avail. – Ivan Jun 24 '09 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.