5

I'm having some serious permission issues with Mac client machines (OS X Snow Leopard) connected to a UNIX server (running CentOS) through Samba. No matter which permissions I set for a file on the server, the Mac ignores them and changes the permissions back to 766.

My goal is to be able to lock a file (744) from other users when its in use or open on a client machine. Other clients should be able to read the file during this time, but not be able to write to it. I found a thread that describes my problem almost exactly suggesting to use the "unix extensions = off" parameter in the global section of the smb.conf file, but to no avail. The parameter is rejected by the "testparm" command on the the version of Samba I am running (3.4); The compiling issue is resolved by changing the parameter to "unix extensions = no" but still fails to resolve the issue.

The same issue arises when I attempt to use AFP.

I'm really unsure of where to turn next, does anyone have any suggestions or information I can utilize to solve this problem?

Thanks!

Chealion
  • 5,713
  • 27
  • 29
synchronicity
  • 85
  • 1
  • 2
  • 7

4 Answers4

8

Sorry this doesn't help the OP, but I can confirm that

unix extensions = no

worked for me. I have Macs running Snow Leopard connecting to Linux (lenny/sid) server with Samba 3.2.3. I am posting this so people will still try that. Much like others, before I put the unix extensions = no line in, the force create mode was being ignored.

mikehapner
  • 1,165
  • 10
  • 9
4

Samba has two ways of setting perms for an uploaded file:

  1. Without UNIX extensions: preset file/directory mask is used
  2. With UNIX extensions (which probably MacOS client has): that allows clients to control file perms

Here's the lines you should add to config file (smb.conf):

# For case 1: no UNIX extensions
create mask = 0644
directory mask = 0755
# For case 2: override UNIX extensions
force create mode = 0644
force directory mode = 0755

(Should be placed BEFORE any share definition goes: this looks like [share name] in square braces and a couple of indented lines. These sets will then apply to all shares you have)

Also read about force group and force user in man smb.conf, if you need it.

kolypto
  • 10,738
  • 12
  • 51
  • 66
  • So by placing the commands under "case 1" in the global section of my smb.conf file, I'll be able to force Mac clients to observe set permissions? Sorry I'm new to using Samba and editing the configuration file. – synchronicity Nov 04 '09 at 01:46
  • Me too, but i've read the whole `man smb.conf` recently :)) Place the whole snippet in your smb.conf file BEFORE any share definition goes: their names are given in square brackets [share_name]. These lines then will apply to all shared folders in config file. – kolypto Nov 04 '09 at 01:52
  • `create mask` and `force create mode` stand for perms that newly created files will have. `directory mask` and `force directory mode` specifies perms for new directories. Cheers! :) – kolypto Nov 04 '09 at 01:54
  • Keep in mind that many applications create new files every time you save. – Zoredache Nov 04 '09 at 02:26
  • These commands did work for disallowing the mac client from rewriting the permissions, but not from ignoring the initial permissions on the file. It seems that any permissions allowing the group to read are interpreted as read and write (i.e., 700 locks the file but 740 allows the user to read AND write to it). Thanks so much for this snippet, its really close to what I need! Any other ideas? – synchronicity Nov 12 '09 at 19:24
  • You're welcome! Use `force group` & `force user` to bind all users of a shared folder to a single local account (yours, maybe?), and all permissions issues will be history :) – kolypto Nov 12 '09 at 23:56
0

In addition to the "force create mode" and "force directory mode" options suggested by kolypto, you may also need

force directory mode = 2770
force security mode = 660

See man smb.conf to adapt the mode bits to your needs.

mivk
  • 3,457
  • 1
  • 34
  • 29
  • These settings have been removed from Samba 4.0.0, which was released in December 2012: https://www.samba.org/samba/history/samba-4.0.0.html – TheDeadSerious Jul 18 '16 at 09:33
0

I think this is not the correct answer of your questin, but it can help you http://www.linuxconfig.net/2009/11/16/file-server-with-samba-and-ftp-in-freebsd.html