Samba: Difference between revisions

From NixOS Wiki
imported>Fadenb
Created page with "== Motivation == This guide will help you on how to use samba on nixos. == excerpt of /etc/nixos/configuration.nix == <pre> services.samba.enable = true; services.samb..."
 
imported>Fadenb
m Syntaxhighlight
Line 4: Line 4:
== excerpt of /etc/nixos/configuration.nix ==
== excerpt of /etc/nixos/configuration.nix ==


  <pre>
<syntaxhighlight lang="nix">
   services.samba.enable = true;
   services.samba.enable = true;
   services.samba.securityType = "share";
   services.samba.securityType = "share";
Line 22: Line 22:
       public = yes
       public = yes
   '';
   '';
</pre>
</syntaxhighlight>


If your firewall is enabled, or if you consider enabling it:
If your firewall is enabled, or if you consider enabling it:
  <pre>
<syntaxhighlight lang="nix">
   networking.firewall.enable = true;
   networking.firewall.enable = true;
   networking.firewall.allowPing = true;
   networking.firewall.allowPing = true;
   networking.firewall.allowedTCPPorts = [ 445 139 ];
   networking.firewall.allowedTCPPorts = [ 445 139 ];
   networking.firewall.allowedUDPPorts = [ 137 138 ];
   networking.firewall.allowedUDPPorts = [ 137 138 ];
</pre>
</syntaxhighlight>


{{Evaluate}}
{{Evaluate}}
Line 37: Line 37:


== stopping/restarting the services ==
== stopping/restarting the services ==
  stop samba
<syntaxhighlight lang="console">
  start samba
# systemctl stop samba
  restart samba
# systemctl start samba
# systemctl restart samba
</syntaxhighlight>


== links ==
== links ==

Revision as of 12:08, 27 August 2017

Motivation

This guide will help you on how to use samba on nixos.

excerpt of /etc/nixos/configuration.nix

  services.samba.enable = true;
  services.samba.securityType = "share";
  services.samba.extraConfig = ''
    workgroup = WORKGROUP
    server string = smbnix
    netbios name = smbnix
    security = share 
    #use sendfile = yes
    #max protocol = smb2
  
    [rw-files]
      comment = Temporary rw files 
      path = /storage
      read only = no
      writable = yes
      public = yes
  '';

If your firewall is enabled, or if you consider enabling it:

  networking.firewall.enable = true;
  networking.firewall.allowPing = true;
  networking.firewall.allowedTCPPorts = [ 445 139 ];
  networking.firewall.allowedUDPPorts = [ 137 138 ];

samba should startup afterwards

stopping/restarting the services

# systemctl stop samba
# systemctl start samba
# systemctl restart samba

links