File sharing cross-platform con SMB/CIFS
Samba implementa il protocollo SMB su Linux, permettendo la condivisione file con client Windows, macOS e Linux.
1. Installazione
apt install samba -y
2. Configurazione (/etc/samba/smb.conf)
[global]
workgroup = WORKGROUP
server string = Homelab File Server
security = user
map to guest = never
min protocol = SMB2
[shared]
path = /srv/samba/shared
browseable = yes
read only = no
valid users = @smbgroup
create mask = 0664
directory mask = 0775
3. Creare utente Samba
groupadd smbgroup
useradd -M -G smbgroup smbuser
smbpasswd -a smbuser
smbpasswd -e smbuser
4. Preparare la directory
mkdir -p /srv/samba/shared
chown root:smbgroup /srv/samba/shared
chmod 2775 /srv/samba/shared
5. Avviare Samba
systemctl enable --now smbd nmbd
testparm
6. Accesso da client
# Linux
mount -t cifs //192.168.1.90/shared /mnt/samba -o username=smbuser
# Windows: \192.168.1.90\shared nel file explorer
Samba è essenziale quando nella rete ci sono client Windows o macOS che devono accedere a file su server Linux.