Spis Treści
Serwer plików SaMBa
Aktualnie są dwie wersje Samba: 3.6.x oraz 4.x. Na razie ze względu na zbyt wielkie rewolucje, korzystam z Samba 3.x.
# This file is auto-generated by 'make config'.
# Options for samba36-3.6.20_1
_OPTIONS_READ=samba36-3.6.20_1
_FILE_COMPLETE_OPTIONS_LIST=ACL_SUPPORT ADS AIO_SUPPORT AVAHI CUPS DNSUPDATE EXP_MODULES FAM_SUPPORT IPV6 LDAP MAX_DEBUG PAM_SMBPASS POPT PTHREADPOOL QUOTAS SMBTORTURE SWAT SYSLOG UTMP WINBIND
OPTIONS_FILE_SET+=ACL_SUPPORT
OPTIONS_FILE_UNSET+=ADS
OPTIONS_FILE_SET+=AIO_SUPPORT
OPTIONS_FILE_UNSET+=AVAHI
OPTIONS_FILE_UNSET+=CUPS
OPTIONS_FILE_UNSET+=DNSUPDATE
OPTIONS_FILE_SET+=EXP_MODULES
OPTIONS_FILE_UNSET+=FAM_SUPPORT
OPTIONS_FILE_UNSET+=IPV6
OPTIONS_FILE_SET+=LDAP
OPTIONS_FILE_UNSET+=MAX_DEBUG
OPTIONS_FILE_UNSET+=PAM_SMBPASS
OPTIONS_FILE_SET+=POPT
OPTIONS_FILE_SET+=PTHREADPOOL
OPTIONS_FILE_SET+=QUOTAS
OPTIONS_FILE_UNSET+=SMBTORTURE
OPTIONS_FILE_SET+=SWAT
OPTIONS_FILE_SET+=SYSLOG
OPTIONS_FILE_SET+=UTMP
OPTIONS_FILE_SET+=WINBIND
Ciekawe linki
Lista linków, które warte są polecenia (zwłaszcza w kontekście ZFSa):
https://mywushublog.com/2012/05/zfs-and-acls-with-samba/ (otwiera się w nowym oknie)
http://www.edplese.com/samba-with-zfs.html (otwiera się w nowym oknie)
http://xenomorph.net/linux/samba/configuration/sample/ (otwiera się w nowym oknie)
Podstawowa konfiguracja
# -------------------------------------------------------------------------
#
# Ustawienia globalne dziedziczone przez poszczeg/olne
# udzia/ly (czy to katalogi domowe, czy te/z inne)
#
# -------------------------------------------------------------------------
#
[global]
# --- Ustawienia podstawowe ------------------------------------------
#
workgroup = KONCEPT
server string = Serwer GDBD
netbios name = KONCEPT2
security = user
domain master = yes
preferred master = yes
wins support = no
dns proxy = no
writeable = no
printable = no
load printers = no
printcap name = /etc/printcap
delete readonly = yes
time server = yes
;;invalid users = root toor bin
vfs objects = shadow_copy2, zfsacl, streams_xattr
# enable SMB2 (3.6+). some have seen this prevent Previous Versions from
# working, but i've seen it make Previous Versions work more reliably in win7/2008r2+
max protocol = SMB2
# hide special OS files or anything unreadable by the client
# this may not be needed
hide special files = yes
hide unreadable = yes
# --- ustawienia sieciowe --------------------------------------------
#
hosts allow = 192.168.128. 127.
interfaces = 192.168.128.16/24
;;socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192
socket options = TCP_NODELAY
bind interfaces only = yes
# --- ustawienia logowania -------------------------------------------
#
log level = 0 vfs:3
log file = /var/log/samba/%m.log
max log size = 8192
# --- ustawienia kodowania znak/ow -----------------------------------
#
dos charset = 852
unix charset = ISO8859-2
display charset = ISO8859-2
# --- ustawienia dotycz/ace u/zytkownik/ow ---------------------------
#
map to guest = Bad User
;username map = /usr/local/etc/samba/smbusers
guest account = nobody
guest ok = no
# --- Shadow copy (ZFS specific) -------------------------------------
#
shadow:snapdir = .zfs/snapshot
shadow:format = %Y-%m-%d
shadow:sort = desc
shadow:localtime = yes
# Store DOS attributes in extended attributes (no mapping)
map hidden = no
map system = no
map archive = no
map readonly = no
store dos attributes = yes
dos filemode = no
ea support = no
# Unix specific
# snapshots use symlinks
wide links = yes
unix extensions = no
follow symlinks = yes
# Name resolution
name resolve order = host bcast
# Blokowanie
locking = no
posix locking = no
;;lock directory = /var/run/samba/
# Asynchroniczne I/O
aio read size = 1
aio write size = 1
# Wsparcie dla ZFS - ACLs
nfs4:mode = special # Use OWNER@ and GROUP@ special IDs
nfs4:acedup = merge # Merge duplicate ACEs
nfs4:chown = yes # Enable changing owner and group
# Dziedziczenie uprawnie/n
nt acl support = yes
inherit owner = yes
inherit acls = no
inherit permissions = no
map acl inherit = yes
acl map full control = no
# Dostrajanie zapisu/odczytu danych
min receivefile size = 131072
use sendfile = yes
getwd cache = yes
keepalive = 300
read raw = yes
write raw = yes
# by default, every file system is read/write, with access controlled by
# file system permissions (NFSv4 ACLs on ZFS)
read only = no
## -- passdb backend = ldapsam:ldap://127.0.0.1/
## -- ldap ssl = Off
## -- ldap suffix = ou=smbd,dc=gdbd,dc=local
## -- ldap user suffix = ou=users
## -- ldap group suffix = ou=groups
## -- # FYI, the password for this user is stored in
## -- # /etc/samba/secrets.tdb. It is created by running
## -- # 'smbpasswd -w passwd'
## -- ldap admin dn = uid=samba_servers,ou=admins,dc=gdbd,dc=local
# -------------------------------------------------------------------------
#
# Katalogi domowe - nie ma potrzeby ju/z definiowa/c
# odddzielnie katalog/ow dla ka/zdego z u/zytkownik/ow
#
# -------------------------------------------------------------------------
#
[homes]
comment = Katalog domowy %u na serwerze %h
path = /opt/samba/homes/%S
valid users = %S
browsable = no
writeable = yes
printable = no
create mask = 0600
directory mask = 0700
valid users = %S
vfs objects = shadow_copy2 zfsacl streams_xattr
hide files = /.cshrc/.login/.login_conf/.mail_aliases/.mailrc/.profile/.rhosts/.shrc/
Sprawdzenie poprawności konfiguracji
# mo/zna pomin/a/c smb.conf (jako domy/slny), jak mamy inna konfiguracj/e to wtedy /scie/zka do pliku
#
testparm -s -v smb.conf
Szybki sposób na przeładowanie konfiguracji bez restartu
Najlepiej przerestartować serwer samba, ale problemem są otwarte przez użytkowników pliki. Aby temu zapobiec jest możliwość przeładowania konfiguracji za pomocą smbcontrol
smbcontrol all reload-config
Sprawdzenie, kto korzysta z zasob/ow SaMBa
smbstatus -v
Ustawienie uprawnień, aby dany zasób można było udział udostępniać dalej
# wylistowanie samych uprawnien
#
net rpc rights list -U root%koncept2
# ustawienie uprawnien dla danego konta
#
net rpc rights grant "KONCEPT2\ewad" SeTakeOwnershipPrivilege SeDiskOperatorPrivilege -U root%koncept2
# wylistowanie uprawnien po zmianach
#
net rpc rights list accounts -U root%koncept2
Trzeba dokończyć...
