sjau / nixos

GNU General Public License v3.0
12 stars 2 forks source link

Are you able to share with samba from NixOS? #1

Open maxdevjs opened 4 years ago

maxdevjs commented 4 years ago

I have a configuration more or less like yours and I can mount remote resources, but not to share from NixOS.

$ net usershare info --long
net usershare: usershares are currently disabled

In Dolphin the Share tab informs that Samba is not installed (!!!)...

Any clues?

sjau commented 4 years ago

Hi have meanwhile altered my configuration.

Since I use wireguard, don't use authentication anymore but give a list of IP addresses that can access my samba:

Open firewall ports:

    networking = {
        ...
        firewall.enable = true;
        firewall.allowPing = true;
        firewall.allowedTCPPorts = [ 139 445 ];
        firewall.allowedUDPPorts = [ 137 138 ];
        ...
    # Samba
    services.samba = {
        enable = true;
        securityType = "user";
        syncPasswordsByPam = true;  # this can probably be removed
        extraConfig = ''
            server string = ${mySecrets.hostname}
            netbios name = ${mySecrets.hostname}
            workgroup = WORKGROUP
            max xmit = 65535
            socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE
            hosts allow = 127.0.0.1 10.20.30.  # 10.20.30.0/24 is my wireguard subnet
            hosts deny = 0.0.0.0/0  # deny access from anywhere else
            security = user
            guest account = ${mySecrets.user}
            map to guest = bad user

            # Disable printer
            printcap name = /dev/null
            load printers = no
            printing = bsd
            show add printer wizard = no
            disable spoolss = yes
        '';
        shares = {
            Desktop = {
                path = "/path/to/share";
                browseable = "yes";
                "read only" = "no";
                "guest only" = "yes";
                "guest ok" = "yes";
                "create mask" = "0644";
                "directory mask" = "0755";
                "hosts allow" = "127.0.0.1 10.20.30."  # probably not needed
            };
        };
    };
maxdevjs commented 4 years ago

Thank you.

Is that your complete Samba config? Tried it and a couple Samba versions and still I have the same usershares are currently disabled issue. What Samba version do you use?