Benutzer-Werkzeuge

Webseiten-Werkzeuge


samba

Mit Samba steht seit 1992 eine Implementation des SMB-Protokolls auch auf UNIX-Systemen (Linux etwas später) zur Verfügung. Ab Samba 3.6 (ab Ubuntu 14.04 LTS) wurden dann auch die Protokolle SMBv2 und SMBv3 schrittweise als Optionen nach Samba übernommen. Seit September 2017 ist nun auch in Samba SMBv3 Standard, und seit Samba 4.11 (ab Ubuntu 20.04 LTS) wird, wie auch in Windows 10, das Protokoll SMBv1 in der Grundeinstellung nicht mehr unterstützt.

Mit Hilfe von NSS und PAM kann Samba sogar einen Active Directory Domänencontroller ersetzen.

  • Laut Samba Wiki unterstützt Samba4 nur den internen LDAP server und eine spezielle Kerberos Distribution (Heimdal).
  • Der Samba interne DNS Server hat auch einige Defizite (keine Wildcard Zertifikate, kein Caching, keine Zone transfers,…) statt dessen ist es besser einen bind DNS server aufzusetzen.

Installation

apt install samba

edit /etc/samba/smb.conf

[Global]
workgroup = WORKGROUP
security = user
map to guest = Bad User
name resolve order = bcast host
include = /etc/samba/shares.conf

[Public Files]
path = /share/public_files
force user = smbuser
force group = smbgroup
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775
public = yes
writeable = yes

[Protected Files]
path = /share/protected_files
force user = smbuser
force group = smbgroup
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775
public = yes
writeable = no
mkdir -p /share/public_files
mkdir -p /share/protected_files

groupadd --system smbgroup
useradd --system smbuser --no-create-home --group smbgroup -s /bin/false

chown -R smbuser:smbgroup /share
chmod -R g+w /share

// add a new user
useradd newuser

// add as smbuser
smbpasswd -a newuser

// delete as smbuser
smbpasswd -x newuser

systemctl start smbd
systemctl status smbd

https://www.youtube.com/watch?v=7Q0mnAT1MRg

Domain Controller

Set static ip, edit

/etc/network/interfaces

<pre> iface eth0 iface eth0 inet static address 192.168.0.2 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 127.0.0.1 192.168.0.1 8.8.8.8 dns-search example.com </code>

Edit hostname in

/etc/hostname

und

/etc/hosts

.

/etc/hostname

dc.example.com

/etc/hosts

127.0.0.1   localhost
192.168.0.2    dc.example.com dc

...

Install packages

apt install -y samba krb5-user krb5-config winbind smbclient

// opt additional
libpam-winbind libnss-winbind

Stop services

systemctl stop samba-ad-dc smbd nmbd winbind
systemctl disable samba-ad-dc smbd nmbd winbind

Remove example config

rm /etc/samba/smb.conf

Domain provision

example

  • realm: example.com
  • domain: example
samba-tool domain provision --interactive --use-rfc2307 --use-ntvfs

mv /etc/krb5.conf /etc/krb5.conf.bak
ln -s /var/lib/samba/private/krb5.conf /etc/

systemctl start samba-ad-dc
systemctl enable samba-ad-dc

Edit

/etc/resolv.conf

.

search example.com
nameserver 127.0.0.1
nameserver 192.168.0.1
nameserver 8.8.8.8

Test dc.

samba-tool domain level show

ping example.com
ping dc.example.com
ping dc

host -t SRV _ldap._tcp.example.com
host -t SRV _kerberos._udp.example.com
host -t A example.com
host -t A dc.example.com

Test kerberos

kinit administrator@example.com

klist

samba-tool

samba-tool user create user1
samba-tool user enable user1
samba-tool group add group1
samba-tool group addmembers group1 user1,user2,..
samba-tool group removemembers group1 user1,user2,..
samba-tool group delete group1
// to create a unix group in samba
samba-tool group add groupname --nis-domain=samdom --gid-number=<next available GID>
samba.txt · Zuletzt geändert: 2023/03/11 01:22 (Externe Bearbeitung)