Samba: Difference between revisions

From Hurlster Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
smb.conf
smb.conf
#======================= Global Settings =======================
<pre>
[global]
[global]
  workgroup = WORKGROUP
  server string = %h
## Browsing/Identification ###
  server role = standalone server
 
# Change this to the workgroup/NT-domain name your Samba server will part of
  # SMB protocol
    workgroup = WORKGROUP
  server min protocol = SMB2
  server max protocol = SMB3
# server string is the equivalent of the NT Description field
 
    server string = %h server (Samba, Ubuntu)
  # macOS compatibility
  vfs objects = fruit streams_xattr
# Windows Internet Name Serving Support Section:
  fruit:metadata = stream
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
  fruit:posix_rename = yes
#  wins support = no
  fruit:veto_appledouble = no
  fruit:delete_empty_adfiles = yes
# WINS Server - Tells the NMBD components of Samba to be a WINS Client
  fruit:wipe_intentionally_left_blank_rfork = yes
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
 
;  wins server = w.x.y.z
  # Stability
  aio read size = 1
# This will prevent nmbd to search for NetBIOS names through DNS.
  aio write size = 1
    dns proxy = no
  strict locking = no
  durable handles = yes
# What naming service and in what order should we use to resolve host names
  kernel oplocks = no
# to IP addresses
  kernel share modes = no
;  name resolve order = lmhosts host wins bcast
 
  # Performance tuning for Windows
#### Networking ####
  socket options = TCP_NODELAY IPTOS_LOWDELAY
  use sendfile = yes
# The specific set of interfaces / networks to bind to
  min receivefile size = 16384
# This can be either the interface name or an IP address/netmask;
 
# interface names are normally preferred
  # Networking
    interfaces = 127.0.0.0/8 eth0 eth1
  interfaces = 127.0.0.0/8 ens192
  bind interfaces only = yes
# Only bind to the named interfaces and/or networks; you must use the
 
# 'interfaces' option above to use this.
  # Permissions
# It is recommended that you enable this feature if your Samba machine is
  inherit permissions = yes
# not protected by a firewall or is a firewall itself.  However, this
  unix extensions = no
# option cannot handle dynamic or non-broadcast interfaces correctly.
 
    bind interfaces only = yes
  map to guest = Bad User
 
#### Debugging/Accounting ####
[storage]
  comment = Storage
# This tells Samba to use a separate log file for each machine
  path = /storage
# that connects
  browseable = yes
    log file = /var/log/samba/log.%m
  writable = yes
  read only = no
# Cap the size of the individual log files (in KiB).
 
    max log size = 1000
  valid users = storage '''username'''
  force user = nobody
# If you want Samba to only log through syslog then set the following
  force group = nogroup
# parameter to 'yes'.
 
#  syslog only = no
  # FORCE permissions regardless of client umask
  force create mode = 0777
# We want Samba to log a minimum amount of information to syslog. Everything
  force directory mode = 2777
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
 
# through syslog you should set the following parameter to something higher.
  create mask = 0777
    syslog = 0
  directory mask = 2777
 
# Do something sensible when Samba crashes: mail the admin a backtrace
  nt acl support = no
    panic action = /usr/share/samba/panic-action %d
 
  # Inherit parent permissions
####### Authentication #######
  inherit permissions = yes
  inherit acls = yes
# "security = user" is always a good idea. This will require a Unix account
 
# in this server for every user accessing the server. See
  follow symlinks = yes
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
  wide links = yes
# in the samba-doc package for details.
 
#  security = user
[TimeMachine]
security = share
  comment = Time Machine Backup
  path = /mnt/timemachine
# You may wish to use password encryption.  See the section on
  browseable = no
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
  hide unreadable = yes
    encrypt passwords = true
  access based share enum = yes
 
# If you are using encrypted passwords, Samba will need to know what
  writable = yes
# password database type you are using. 
  read only = no
    passdb backend = tdbsam
 
  # Time Machine requirements
    obey pam restrictions = yes
  vfs objects = fruit streams_xattr
  fruit:time machine = yes
# This boolean parameter controls whether Samba attempts to sync the Unix
  fruit:time machine max size = 5000G
# password with the SMB password when the encrypted SMB password in the
  fruit:model = MacSamba
# passdb is changed.
 
    unix password sync = yes
  # Security (REQUIRED)
  guest ok = no
# For Unix password sync to work on a Debian GNU/Linux system, the following
  valid users = '''username'''
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
</pre>
# sending the correct chat script for the passwd program in Debian Sarge).
    passwd program = /usr/bin/passwd %u
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
    pam password change = yes
# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
    map to guest = bad user
[storage]
  comment = Network Storage
  path = /var/local/storage
  guest ok = yes
  browseable = yes
  create mask = 0755
  directory mask = 0755
  read only = no


[[Category:Linux]]
[[Category:Linux]]

Revision as of 23:45, 22 March 2026

smb.conf

[global]
   workgroup = WORKGROUP
   server string = %h
   server role = standalone server

   # SMB protocol
   server min protocol = SMB2
   server max protocol = SMB3

   # macOS compatibility
   vfs objects = fruit streams_xattr
   fruit:metadata = stream
   fruit:posix_rename = yes
   fruit:veto_appledouble = no
   fruit:delete_empty_adfiles = yes
   fruit:wipe_intentionally_left_blank_rfork = yes

   # Stability
   aio read size = 1
   aio write size = 1
   strict locking = no
   durable handles = yes
   kernel oplocks = no
   kernel share modes = no

   # Performance tuning for Windows
   socket options = TCP_NODELAY IPTOS_LOWDELAY
   use sendfile = yes
   min receivefile size = 16384

   # Networking
   interfaces = 127.0.0.0/8 ens192
   bind interfaces only = yes

   # Permissions
   inherit permissions = yes
   unix extensions = no

   map to guest = Bad User

[storage]
   comment = Storage
   path = /storage
   browseable = yes
   writable = yes
   read only = no

   valid users = storage '''username'''
   force user = nobody
   force group = nogroup

   # FORCE permissions regardless of client umask
   force create mode = 0777
   force directory mode = 2777

   create mask = 0777
   directory mask = 2777

   nt acl support = no

   # Inherit parent permissions
   inherit permissions = yes
   inherit acls = yes

   follow symlinks = yes
   wide links = yes

[TimeMachine]
   comment = Time Machine Backup
   path = /mnt/timemachine
   browseable = no
   hide unreadable = yes
   access based share enum = yes

   writable = yes
   read only = no

   # Time Machine requirements
   vfs objects = fruit streams_xattr
   fruit:time machine = yes
   fruit:time machine max size = 5000G
   fruit:model = MacSamba

   # Security (REQUIRED)
   guest ok = no
   valid users = '''username'''