|
Rozmiar: 5255
Komentarz: + smbcontrol
|
← Wersja 3 z 2014-02-07 09:19:18 ⇥
Rozmiar: 7861
Komentarz: uporządkowanie konfiguracji po ciężkich walkach z zfsacl
|
| Usunięcia zostały oznaczone w ten sposób. | Dodatki zostały oznaczone w ten sposób. |
| Linia 38: | Linia 38: |
| * https://mywushublog.com/2012/05/zfs-and-acls-with-samba/ * http://www.edplese.com/samba-with-zfs.html |
* [[https://mywushublog.com/2012/05/zfs-and-acls-with-samba/||target="_blank"]] (otwiera się w nowym oknie) * [[http://www.edplese.com/samba-with-zfs.html||target="_blank"]] (otwiera się w nowym oknie) * [[http://xenomorph.net/linux/samba/configuration/sample/||target="_blank"]] (otwiera się w nowym oknie) |
| Linia 43: | Linia 44: |
| #======================= Global Settings ===================================== | # ------------------------------------------------------------------------- # # Ustawienia globalne dziedziczone przez poszczeg/olne # udzia/ly (czy to katalogi domowe, czy te/z inne) # # ------------------------------------------------------------------------- # |
| Linia 45: | Linia 52: |
| log level = 0 log file = /var/log/samba/%m.log max log size = 50 delete readonly = yes |
# --- Ustawienia podstawowe ------------------------------------------ # |
| Linia 52: | Linia 57: |
| 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 -------------------------------------------- # |
|
| Linia 54: | Linia 84: |
| ;;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 --------------------------- # |
|
| Linia 58: | Linia 106: |
| security = user max log size = 50 load printers = no display charset = ISO8859-2 dos charset = 852 unix charset = ISO8859-2 ;;socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192 socket options = TCP_NODELAY aio read size = 16384 domain master = yes preferred master = yes dns proxy = no writeable = no printable = no # Shadow copy shadow:snapdir = .zfs/snapshot shadow:format = %Y-%m-%d shadow:sort = desc |
# --- Shadow copy (ZFS specific) ------------------------------------- # shadow:snapdir = .zfs/snapshot shadow:format = %Y-%m-%d shadow:sort = desc shadow:localtime = yes |
| Linia 85: | Linia 120: |
| ea support = yes | dos filemode = no ea support = no |
| Linia 88: | Linia 124: |
| wide links = no unix extensions = yes |
# snapshots use symlinks wide links = yes unix extensions = no follow symlinks = yes |
| Linia 93: | Linia 131: |
| wins support = no | # 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 |
| Linia 97: | Linia 145: |
| map acl inherit = yes time server = yes ;; invalid users = root toor bin invalid users = bin unix extensions = no |
# Dziedziczenie uprawnie/n |
| Linia 103: | Linia 148: |
| inherit acls = yes | |
| Linia 105: | Linia 149: |
| inherit acls = no inherit permissions = no |
|
| Linia 106: | Linia 152: |
| vfs objects = zfsacl locking = no posix locking = no |
acl map full control = no # Dostrajanie zapisu/odczytu danych |
| Linia 110: | Linia 156: |
| aio read size = 1 aio write size = 1 |
|
| Linia 113: | Linia 157: |
| lock directory = /var/run/samba/ | getwd cache = yes |
| Linia 115: | Linia 159: |
| 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 |
|
| Linia 133: | Linia 193: |
| vfs objects = zfsacl shadow_copy2 | vfs objects = shadow_copy2 zfsacl streams_xattr |
| Linia 135: | Linia 195: |
| }}} == Sprawdzenie poprawności konfiguracji == {{{#!shell numbers=off # 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 |
|
| Linia 143: | Linia 210: |
| == Sprawdzenie, kto korzysta z zasob/ow SaMBa == {{{#!shell numbers=off smbstatus -v }}} |
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ć...
