Veröffentlichung 3. September 2018 @ 21:33
Letzte Änderung 3. September 2018 @ 21:33
Übersicht
- Netzwerkprotokoll Server Message Block SMB für Zugriff von Unix-Systemen auf Windows-Systeme
- Einbindung von Windows-Freigaben mit Common Internet File System CIFS
- Einsatz von SMB / CIFS nur in lokalen Netzwerken sinnvoll
Voraussetzungen
Samba-Client
- Benutzerkonto sambauser
- Betriebsystem Ubuntu Server 16.04.05 LTS #lsb_release -a
- Einhängepunkt /media/windows/share
- Konfiguration /etc/fstab, /etc/samba/smb.conf, /home/sambauser/.samba-credentials-windows-share
- Software Samba-Client 4.3.11 #smbclient –version
Windows-Server
- Benutzerkonto windowsuser
- Betriebsystem Windows 10
- FQDN windows.example.local
- Freigabe //windows.example.local/share
- IP-Adresse x.x.x.x
- NetBIOS-Name WINDOWS
Samba-Client und Hilfprogramme installieren
Samba-Client smbclient
apt install smbclient
Gemeinsame Dateien für Samba-Server und -Client für testparm
apt install samba-common-bin
cifs-utils zur Einbindung des virtuellen Dateisystems cifs-vfs mit mount-Option cifs
apt install cifs-utils
Samba konfigurieren und Konfigurationsdatei überprüfen
... [global] ... ###Client #Protokoll SMB3 für Windows ab Windows 8 / Windows Server 2012: client max protocol = SMB3 client min protocol = SMB3 ... #testparm 'WARNING: The "syslog" option is deprecated': #syslog = 0 ...
testparm
Authentifikationsdatei für Server-Freigabe anlegen und Zugriffsrechte anpassen
username=windowsuser password=***
chmod 0600 /home/sambauser/.samba-credentials-windows-share
Freigaben und weitere Informationen über Server WINDOWS ausgeben
smbclient --authentication-file=/home/sambauser/.samba-credentials-windows-share --list //WINDOWS
Mit Samba-Client auf Server-Freigabe zugreifen
smbclient --authentication-file=/home/sambauser/.samba-credentials-windows-share //windows.example.local/share
Server-Freigabe temporär einbinden
Einhängepunkt anlegen
mkdir --parents /media/windows/share
Freigabe mit Protokoll SMB3 einbinden
mount -o credentials=/home/sambauser/.samba-credentials-windows-share,vers=3.0 -t cifs //x.x.x.x/share /media/windows/share
[Optional] Freigabe aushängen und Einhängepunkt löschen
umount /media/windows/share rm /media/windows/share
Server-Freigabe dauerhaft einbinden
Einhängepunkt anlegen
mkdir --parents /media/windows/share
Konfigurationsdatei für einzubindendes Verzeichnis ergänzen
... #Server-Freigabe von windows.example.local einbinden: //x.x.x.x/share /media/windows/share cifs /home/sambauser/.samba-credentials-windows-share,vers=3.0 0 0
Quellen
http://manpages.ubuntu.com/manpages/xenial/man1/smbclient.1.html
http://manpages.ubuntu.com/manpages/xenial/man1/testparm.1.html
http://manpages.ubuntu.com/manpages/xenial/man5/fstab.5.html
http://manpages.ubuntu.com/manpages/xenial/man5/smb.conf.5.html
http://manpages.ubuntu.com/manpages/xenial/man8/mount.cifs.8.html
http://manpages.ubuntu.com/manpages/xenial/man8/umount.8.html
https://wiki.samba.org/