PDA

View Full Version : Linux-to-Linux CIFS/SMB perms problems.


Thetargos
2008-08-20, 05:08 PM CDT
I have a CentOS server setup as a file server with Samba and mount the shares on different machines through CIFS on Fedora. However I have a problem. All shares are mounted through user/password. Needless to say that Windows machines do not have any problems accessing the shares. The problem I have is that when a file is written to the share, the perms inherited are 0755. Now Windows machines do not have problems with that as the UID/GID bits seem to be ignored by the OS (or are inherited by the login parameters of the shares), however, Linux machines exhibit a behaviour so that I had to create a local group to which users with access to the shares belong. The mount point of the CIFS share is set so that users of the group have write access to it, however, once a file is written the perms are set to 755 again (rw-r--r--). I changed the umask for the shares in the server to 775, but the creation mask for the share seems to be 0755 rather than 0775. Now, I'm guessing I have to change the umask on the local systems where the shares are actually mounted?

Before anyone asks, I tried to export the same share with NFS from the server, but hit the very same problem with it, and for some reason CIFS seems to be much faster (network transfers at full 100mbit/s) than with NFS.

Thetargos
2008-08-20, 09:04 PM CDT
Follow up.

I don't understand this. If I change the umask of the share to 0002 (or 0775 or rwxrwxr-x), there is something odd. If I create a regular file, it inherits the right perms (664 or -rw-rw-r--), but if I create a directory, it keeps the same perms, i.e 755 or -rwxr-xr-x). How can I correct this so that all files and directories are created with the right perms of 775 (for dirs) and 664 for files?

Thetargos
2008-08-20, 10:29 PM CDT
Follow up 2.

So, I feel like a complete sucker. It turns out that I had to edit smb.conf in order to set the file and directory creation mask properly. Indeed having a group in the local system to which users could be members of, matching the group to which the share is mapped in the server, and mounting the share with username and password does help, as all commands go to the share as only one user. However, local users are not that user and while they have group access to the share, they weren't able to have write perms. I solved this with these two options for the Global (could be placed also in the share options) of smb.conf:


creation mask = 775
directory mask = 775

Restarted the service, remounted the share, and all is good now.

jayanatl
2008-08-25, 06:11 AM CDT
so every thing is good after sbm.conf has been editted?

glennzo
2008-08-25, 06:39 AM CDT
All with no help from the peanut gallery, myself included :p

Thetargos
2008-08-25, 12:47 PM CDT
so every thing is good after sbm.conf has been editted?
Yes, it is.

And Glen, well... No one really replied in the time I was addressing this particular issue ;)