Skip to content

Instantly share code, notes, and snippets.

@hsupu
Last active September 13, 2019 04:17
Show Gist options
  • Save hsupu/e70b9821ef70d9d4c4d0b986ed9fff13 to your computer and use it in GitHub Desktop.
Save hsupu/e70b9821ef70d9d4c4d0b986ed9fff13 to your computer and use it in GitHub Desktop.
A samba config file for file sharing
# see smb.conf(5)
# see https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html
# run "testparm" to check syntax errors
[global]
client min protocol = SMB2
server string = %h (samba on Ubuntu)
# NT-domain
workgroup = WORKGROUP
# samba-nmbd: enable WINS(Windows Internet Name Service) or not
wins support = yes
# samba-nmbd: run as WINS client if set, otherwise WINS server
wins server = 192.168.13.3
# samba-nmbd: search for NetBIOS names through DNS or not
dns proxy = no
# bind restricted or not
bind interfaces only = yes
# can be a set of interfaces and IP-subnets
interfaces = 127.0.0.0/8 eno1
server role = standalone server
# auth on user-level or share-level
security = user
passdb backend = tdbsam
obey pam restrictions = yes
# treat as guest if username not specified
map to guest = bad user
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
syslog only = no
# 0 for no info on syslog, please see logfile instead
syslog = 0
# %m for separating log for each machine
log file = /var/log/samba/log.%m
log level = 1
# in KiB
max log size = 1000
# run script if smbd crashes
panic action = /usr/share/samba/panic-action %d
# we do not configure as domain controller, so no logon_*
# include machine specified config
include = /etc/samba/smb.conf.%m
# setup usershare options to enable non-root users to modify share folders with the "net usershare" command.
# 0 (default) means usershare is disabled
usershare max shares = 127
# allow to create public shares or not
usershare allow guests = yes
[homes]
comment = Home Directories
# no listable for security concerns
browseable = no
# user acl
# %s means only "user" can connect to "\\server\user"
valid users = %S
# allow no guest to access
guest ok = no
# no for writable
read only = no
# file creation mask
create mask = 0644
# directory creation mask
directory mask = 0700
# section <share-name> for "\\server\<share-name>"
[disk1]
comment = Disk 1
path = /media/data1
browseable = yes
available = yes
valid users = %U, %S, @sambashare
guest ok = no
read only = no
create mask = 0664
directory mask = 0755
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment