Samba shares to MacOS

Hi Guys,

I’m trying to create 3 different samba shares with different user/password and connect to them from MacOS.

Share:Media → user:Media
Share:InAndOut → user: PUBLIC
Share:Documents → user:john

so now my problem is that in MacOS if I connect to “nixSamba” as john, I actually see also the Media content, instead I will like to have and different user password for the Media share

is that because I need to create different mnt?

services.samba = {
  enable = true;
  securityType = "user";
  extraConfig = ''
    workgroup = WORKGROUP
    server string = nixsamba
    netbios name = nixsamba
    security = user 
    #use sendfile = yes
    #max protocol = smb2
    # note: localhost is the ipv6 localhost ::1
    hosts allow = 192.168.10. 192.168.20. localhost
    hosts deny =
    guest account = nobody
    map to guest = bad user
  shares = {
    Media = {
      path = "/mnt/usb-wd-external/Media";
      browseable = "yes";
      "read only" = "no";
      "guest ok" = "no";
      "create mask" = "0644";
      "directory mask" = "0755";
      "force user" = "media"; # <---------
      "force group" = "users";
    # public
     InAndOut = {
      path = "/mnt/usb-wd-external/InAndOut";
      browseable = "yes";
      "read only" = "no";
      "guest ok" = "yes";   # <---------
      "create mask" = "0644";
      "directory mask" = "0755";
      "force user" = "john";
      "force group" = "users";

     Documents = {
      path = "/mnt/usb-wd-external/Documents";
      browseable = "yes";
      "read only" = "no";
      "guest ok" = "no";
      "create mask" = "0644";
      "directory mask" = "0755";
      "force user" = "john";   # <---------
      "force group" = "users";

I avoid SMB if possible, and if you can use NFS, you’ll have a much better time than server message block…for a multitude of reasons. but if your hands are tied, and you’ve force to use SMB…then…

the nixos test for this is basic unfortunately,


seems to be a much more fully fledged configuration and more options you can play with.

1 Like

Thank you @nixinator,

I am wondering is you can share same example of NFS share (private and public)

Thank you!


No worries.

If you want to configure any service , either look at the tests.

they are a great starting point to any ‘how do i deploy X’.

and the wiki, how ever some of it can be a little out of date.but it’s still cool.

I’m not sure about the state of the NFS in OSX currently, so that might be a bit more tricky if it’s needs intergration with kerberos, or some other directory services…Last time i did, it was fairly simple.

However this post and ‘solution’ further enforces to me the software entropy happening at apple (owned by microsoft).

so maybe SMB is the best way to go.

The best mac I had in the last 5 years, was the one i wiped OSX and installed Nixos :wink:

1 Like