# cifs - cannot write to newly created files/dirs

## kvap

I mount a windows share this way (fstab):

```

//10.0.0.110/share /mnt/share  cifs   auto,username=smb_user,password=123,uid=root,gid=users,codepage=866,dir_mode=0770,file_mode=0660,sync   0 0

```

After mounting there are correct owners/permissions on already existing files:

```

$ pwd

/mnt/share

$ ls -l

drwxrwx--- 1 root users 0 Май 17  2008 asd

```

But:

```

$ mkdir dsa; ls -l

итого 0

drwxrwx--- 1 root users 0 Май 17  2008 asd

drwxr-xr-x 2 root users 0 Май 17  2008 dsa

```

So I cannot, for example, copy a directory with files to this share - the directory is created, but with r-x permissions for group 'users' until remounting.

I can change my umask and then it works fine:

```

$ umask 007; mkdir okay; ls -l

итого 0

drwxrwx--- 1 root users 0 Май 17  2008 asd

drwxr-xr-x 2 root users 0 Май 17  2008 dsa

drwxrwx--- 2 root users 0 Май 17  2008 okay

```

Bit I don't want to create all my files, even outside this share, with umask 007.

Is there a way to specify umask for this share that will override user's umask?

Tried to set it in fstab,

```

//10.0.0.110/share /mnt/share  cifs   auto,username=smb_user,password=123,uid=root,gid=users,codepage=866,dir_mode=0770,file_mode=0660,sync,umask=007   0 0

```

, but this changed nothing.

----------

## SeaTiger

Set the file mask in the sambe config, not in the mount option.

----------

## kvap

I thought the only config for mount.cifs are the mount options...

----------

## SeaTiger

oh, I mean the /etc/samba/smb.conf in the samba server.

----------

## kvap

The server is Windows  :Razz: 

----------

## javeree

I believe you may be facing the same problem I have (and which I've been unabel to get solved in the fast few months). Are we talking about Windows XP Home here ?

See https://forums.gentoo.org/viewtopic-t-543689-highlight-samba+permissions.html

Can you reproduce the same problem ?

----------

## SeaTiger

Try

```
//10.0.0.110/share /mnt/share  cifs   auto,username=smb_user,password=123,uid=root,gid=users,codepage=866,dir_mode=0770,file_mode=0660,directio   0 0
```

----------

## kvap

junksiu, this didn't help.

javeree, Windows is Pro 64bit, but situation looks extremely same.

I also tried mounting a share of another server - under Gentoo.

Here are fragments of smb.conf on it:

```

...

[sandbox]

   comment = The Sandbox

   path = /home/sandbox

   valid users = @smb_sandbox

   public = no

   writable = yes

   printable = no

   create mask = 0770

   force create mode = 0770

   directory mask = 0770

   force directory mode = 0770

...

```

```

...

[global]

   unix extensions = no

...

```

The result the same.

On client:

```

$ mount.cifs --version

mount.cifs version: 1.10

```

----------

