Samba: Difference between revisions

From Hurlster Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(One intermediate revision by the same user not shown)
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
    workgroup = WORKGROUP
# server string is the equivalent of the NT Description field
    server string = %h server (Samba, Ubuntu)
# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
#  wins support = no
# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;  wins server = w.x.y.z
# This will prevent nmbd to search for NetBIOS names through DNS.
    dns proxy = no
# What naming service and in what order should we use to resolve host names
# to IP addresses
;  name resolve order = lmhosts host wins bcast
#### Networking ####
# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
    interfaces = 127.0.0.0/8 eth0 eth1
# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself.  However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
    bind interfaces only = yes
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
    log file = /var/log/samba/log.%m
# Cap the size of the individual log files (in KiB).
    max log size = 1000
# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
#  syslog only = no
# We want Samba to log a minimum amount of information to syslog. Everything
# 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.
    syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
    panic action = /usr/share/samba/panic-action %d
####### Authentication #######
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
#  security = user
security = share
# You may wish to use password encryption.  See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
    encrypt passwords = true
# If you are using encrypted passwords, Samba will need to know what
# password database type you are using. 
    passdb backend = tdbsam
    obey pam restrictions = yes
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
    unix password sync = yes
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# 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


  # 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'''
</pre>
Avahi Service
<pre>
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">%h</name>
  <service>
    <type>_smb._tcp</type>
    <port>445</port>
  </service>
  <service>
    <type>_device-info._tcp</type>
    <port>0</port>
    <txt-record>model=TimeCapsule8,119</txt-record>
  </service>
  <service>
    <type>_adisk._tcp</type>
    <txt-record>dk0=adVN=TimeMachine,adVF=0x82</txt-record>
    <txt-record>sys=waMa=0,adVF=0x100</txt-record>
  </service>
</service-group>
</pre>
[[Category:Linux]]
[[Category:Linux]]

Latest revision as of 23:46, 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'''

Avahi Service

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">%h</name>
  <service>
    <type>_smb._tcp</type>
    <port>445</port>
  </service>
  <service>
    <type>_device-info._tcp</type>
    <port>0</port>
    <txt-record>model=TimeCapsule8,119</txt-record>
  </service>
  <service>
    <type>_adisk._tcp</type>
    <txt-record>dk0=adVN=TimeMachine,adVF=0x82</txt-record>
    <txt-record>sys=waMa=0,adVF=0x100</txt-record>
  </service>
</service-group>