Samba File-Server

Siehe auch

Installation

dnf -y install samba samba-client
systemctl enable --now smb.service nmb.service

Einfachster Samba-Share ohne Passwort-Authentifizierung

Vollständige Anleitung: Samba-Share ohne Authentifizierung anbieten, beispielsweise für ISO-Files über einen /isos/-Ordner. Achtung: Der in der Konfigurationsdatei gewählte Name der Sektion wird als Share-Name verwendet (hier also [isos]).

Ab Windows 10 1709 kann der Gastzugang in SMB2 und SMB3 standardmässig deaktiviert sein. Kann also sein, dass der Gastzugriff von Windows 10 auf eine Samba-Freigabe möglicherweise nicht funktioniert (weitere Informationen).

mkdir /isos
/etc/samba/smb.conf
[global]
log file = /var/log/samba/%m
log level = 3
map to guest = Bad User
server role = standalone server

[isos]
# This share allows anonymous (guest) access without authentication!
guest ok = yes
guest only = yes
path = /isos
read only = yes
testparm -s
systemctl restart smb

SELinux:

semanage fcontext -a -t samba_share_t '/isos(/.*)?'
restorecon -Fvr /isos/*

Test des Mounts:

smbclient --user guest --no-pass //samba-server/isos

Verbinden mit:

sudo mount --type cifs //samba-server/isos --options sec=none --verbose /mnt/smb

Einfachster Samba-Share mit Passwort-Authentifizierung

Wie oben, aber mit abweichender Konfiguration:

/etc/samba/smb.conf
[global]
log file = /var/log/samba/%m
log level = 3
server role = standalone server

[isos]
# This share requires authentication to access
inherit permissions = yes
path = /isos
read only = yes
unix password sync = yes

Benutzer anlegen:

useradd linus --shell /usr/sbin/nologin
smbpasswd -a linus

Test des Mounts:

smbclient --user linus //samba-server/isos

Verbinden mit:

mount --type cifs //samba-server/isos --options username=linus,password=linuxfabrik --verbose /mnt/smb

Built on 2023-03-17