Questa guida illustra come installare un file server Samba su Debian Etch, configurarlo per condividere file tramite il protocollo SMB e aggiungere utenti. Samba è configurato come server standalone anziché come domain controller. Se invece vuoi che Samba agisca come domain controller, fai riferimento a questa guida: https://www.howtoforge.com/samba_domaincontroller_setup_ubuntu_6.10
Nella configurazione finale, ogni utente ottiene una home directory personale raggiungibile via SMB e tutti gli utenti condividono anche una directory comune con accesso in lettura/scrittura.
Installazione di Samba
Installa i pacchetti Samba di Debian:
apt-get install libcupsys2 samba samba-common
Rispondi alle seguenti domande:
Please specify the workgroup you want this server to appear to be in when queried by clients. Note that this parameter also controls the domain name used with the security=domain setting.
Workgroup/Domain Name:
-> workgroup
If your computer gets IP address information from a DHCP server on the network, the DHCP server may also provide information about WINS servers ("NetBIOS name â servers") present on the network. This requires a change to your smb.conf file so that DHCP-provided WINS settings will automatically be read from /etc/samba/dhcp.conf.
The dhcp3-client package must be installed to take advantage of this feature.
Modify smb.conf to use WINS settings from DHCP?
-> no
Modifica il file smb.conf:
vi /etc/samba/smb.conf
Nella sezione global, rimuovi il ";" all'inizio della riga security = user in modo che diventi:
security = user
Ciò consente agli utenti di sistema Linux di accedere al server Samba.
Nella sezione [homes], cambia writable = no in:
writable = yes
Chiudi il file e riavvia Samba:
/etc/init.d/samba restart
Ora aggiungerò una condivisione accessibile a tutti gli utenti.
Crea la directory condivisa e imposta il proprietario sul gruppo users:
mkdir -p /home/shares/allusers
chown -R root:users /home/shares/allusers/
chmod -R ug+rwx,o+rx-w /home/shares/allusers/
Alla fine di /etc/samba/smb.conf, aggiungi queste righe:
[allusers] comment = All Users path = /home/shares/allusers valid users = @users force group = users create mask = 0660 directory mask = 0771 writable = yes
Ora riavvia Samba:
/etc/init.d/samba restart
Aggiungere e gestire gli utenti
In questo esempio aggiungerò un utente chiamato tom. Puoi aggiungere tutti gli utenti che vuoi allo stesso modo, basta sostituire il nome utente tom nei comandi con il nome che desideri.
useradd tom -m -G users
Ora aggiungi l'utente al database utenti di Samba.
smbpasswd -a tom
-> Inserisci la password per il nuovo utente
A questo punto dovresti essere in grado di accedere da una workstation Windows usando Esplora risorse, con il nome utente tom e la password che hai scelto, e di archiviare file sul server Linux nella home directory di tom oppure nella directory pubblica condivisa.
Link
- https://www.debian.org
- https://www.samba.org