[Samba] File permissions and Unix umask.

Gerry Marthe gmarthe at lateralplains.com
Wed Oct 8 13:58:41 GMT 2008


I have a question about file permissions and how they are affected by a
client's umask.

To illustrate my question, I issued the following commands first on a
local ext3 file system and
then on a cifs file system:

$ umask 0002
$ touch f1
$ echo xx > f2
$ umask 0022
$ touch f3
$ echo xx > f4
$ ls -l

On Ext3, the output is:

-rw-rw-r-- 1 abdv29 users 0 Oct  9 00:31 f1
-rw-rw-r-- 1 abdv29 users 3 Oct  9 00:31 f2
-rw-r--r-- 1 abdv29 users 0 Oct  9 00:31 f3
-rw-r--r-- 1 abdv29 users 3 Oct  9 00:31 f4

On a CIFS mount the output is:

-rw-rw-r-- 1 abdv29 users 0 Oct  9 00:35 f1
-rw-rw-r-- 1 abdv29 users 3 Oct  9 00:35 f2
-rw-r--r-- 1 abdv29 users 0 Oct  9 00:35 f3
-rw-rw-r-- 1 abdv29 users 3 Oct  9 00:35 f4

The relevant section from smb.conf on the samba server is:

        comment = Common Area
        path = /common
        read only = no
        valid users = @users
        create mask = 0660
        force create mode = 0660
        force directory mode = 775
        write list = @users
        force group = users
        directory mask = 0775

The share is mounted on a Linux system with the following command:

mount.cifs //localhost/common /mnt/smb -o

>From what I have understood of the samba documentation, the various file
creation masks specified
by Samba do not override a client umask.

If that is so, I would expect that the permissions for file "f4" on the
cifs mount should be 644
(rw-r--r--) rather than 664 which it is.

Can someone please explain why on the CIFS mount, with a umask of 0022,
files created with "touch"
and "echo" end up with different group permissions?  (Noting of course
that on a non CIFS file system,
these commands produce files with identical permissions).

The above seems inconsistent to me.  My aim is to have a Samba share on
which all files created
will be group writable - I expect to have Windows users, Mac users and
Linux users.  I would rather not
have to ask all the Mac and Linux users to change their umasks to
0002 ... or is this the only

I am using Samba version 3.2.3-0.20 on Fedora 9.

Thanks in advance.



This message has been scanned for viruses and dangerous content 
by MailScanner and is believed to be clean.

More information about the samba mailing list