Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I try to mount a samba share with cifs and set write permission to the group on the default file/directory creation mask.
After hours spent searching the web and trying, I can't get this to work, all my files are created with "rw-r--r--" and I want "rw-rw----"

My serveur is a Debian on Cubieboard (Cubian r4)
All umasks of all users are set to 002 using /etc/pam.d/common-session file with "session optional pam_umask.so umask=002"
This works great.

My client is Ubuntu Desktop 64bit 13.10.
All umasks of all users are set to 002 using /etc/bash.bashrc file with umask 002 (because the pam_umask.so doesn't work on the client).
This works great too.

User "bertrand" and group "nas" exist on both the client and the server.
On the server, user "bertrand" has only one group "nas".
On the client, user "bertrand" has "nas" as secondary group.
User bertrand has same password on client, server and samba server.

=> /etc/samba/smb.conf on the server :

[global]
server string = %h
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
name resolve order = lmhosts host wins bcast
dns proxy = No
wins support = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb

[NAS]
comment = NAS drive
path = /media/usbnas
valid users = @nas
force group = nas
read only = No
create mask = 0660
directory mask = 0771

=> /etc/fstab on the client:

//smbserver/nas /media/nas      cifs    uid=bertrand,gid=nas,credentials=/root/.smbcredentials     0     0

The .smbcredentials contains:

username=bertrand
password=********

The mounting point works on my client, I can browse my nas, create, delete, modify files and directories but all new files and all new directories always has read only permission for group.

How to give group write permissions by default ?

Thanks.

share|improve this question
add comment

1 Answer

can you try to add mount option "file_mode=0770,dir_mode=0770"

1) try to modify /etc/fstab file
//smbserver/nas /media/nas cifs uid=bertrand,gid=nas,credentials=/root/.smbcredentials,file_mode=0770,dir_mode=0770 0 0

2) Or, mount command
sudo mount -t cifs //smbserver/nas /media/nas -o uid=bertrand,gid=nas,rw,credentials=/root/.smbcredentials,file_mode=0770,dir_mode=0770

my test environment
os version : Ubuntu 10.04.4 LTS
kernel version : 2.6.35-25
mount.cifs version: 1.12-3.4.7
samba version : Version 3.4.7

share|improve this answer
    
if my answer is right, can you give me any help about my question? –  user221594 Dec 4 '13 at 5:18
    
my quetion is askubuntu.com/questions/385317/… –  user221594 Dec 4 '13 at 5:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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