Vediamo come configurare un server debian affinché fornisca accesso alle cartelle via samba (cioè mediante il protocollo cifs).
- Installiamo il software necessario:
# apt-get install samba samba-common
- Creiamo una copia del file di configurazione:
# mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
# cat /etc/samba/smb.conf.orig | grep -v "#" | grep -v ";" > /etc/samba/smb.conf
- Creiamo ora una password per l’utente utente1:
# smbpasswd -a utente1
New SMB password:
Retype new SMB password:
Added user utente1.
- Ora andiamo a modificare il file smb.conf in /etc/samba andando ad impostare i valori in global workgroup e usershare allow guests. Mentre per lo share homes impostiamo browseable a yes e read only a no, quindi sempre in homes aggiungiamo la dicitura path = /home/%S/shares (shares è la cartella che voglio sia condivisa come home dell’utente), di seguito un esempio del file smb.conf che ho utilizzato:
# cat /etc/samba/smb.conf
[global] <strong>workgroup = CASA</strong> dns proxy = no log file = /var/log/samba/log.%m max log size = 1000 syslog = 0 panic action = /usr/share/samba/panic-action %d server role = standalone server passdb backend = tdbsam obey pam restrictions = yes unix password sync = yes passwd program = /usr/bin/passwd %u passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* . pam password change = yes map to guest = bad user <strong> usershare allow guests = yes </strong>[homes] comment = Home Directories <strong> browseable = yes </strong><strong> read only = no </strong> create mask = 0700 directory mask = 0700 valid users = %S <strong> path = /home/%S/shares </strong>[printers] comment = All Printers browseable = no path = /var/spool/samba printable = yes guest ok = no read only = yes create mask = 0700 [print$] comment = Printer Drivers path = /var/lib/samba/printers browseable = yes read only = yes guest ok = no
- Infine riavviamo il servizio samba:
# /etc/init.d/smbd restart
[ ok ] Restarting smbd (via systemctl): smbd.service.