Instalare si configurare Samba
Posted: July 11, 2009 at 8:04 pm | Tags: Linux, network, samba, smb, tcp/ip, winsSamba este un soft open source, care permite sistemelor de operare unix-based sa “se vada” in retea cu PC-urile cu Windows. Samba este de fapt implementarea mai multor protocoale intr-un singur soft capabil sa comunice simultan cu aceste protocoale: SMB, TCP/IP, NetBIOS (protocolul implementat in Network Neighborhood din Windows), WINS si Active Directory (pt asta trebuie setat kerberos).
In primul rand, pentru a seta cu succes Samba, trebuie ca masina pe care ruleaza linux sa aibe IP static. In caz contrar, nu se va putea folosi WINS…
Se instaleaza Samba:
#sudo apt-get install samba
Dupa instalare, trebuie sa ne asiguram ca Samba nu ruleaza:
#sudo /etc/init.d/samba stop
smb.conf este fisierul de configurare al Samba. Vom redenumi acest fisier in cele ce urmeaza:
#sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.template
Cu urmatoarea comanda vom crea un fisier nou:
#sudo touch /etc/samba/smb.conf
Dupa care vom edita noul fisier in editorul preferat:
#sudo gedit /etc/samba/smb.conf
Cam asta ar trebui pus in noul fisier:
[global]
; General server settings
netbios name = YOUR_HOSTNAME
server string =
workgroup = YOUR_WORKGROUP
announce version = 5.0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
passdb backend = tdbsam
security = user
null passwords = true
username map = /etc/samba/smbusers
name resolve order = hosts wins bcast
wins support = yes
printing = CUPS
printcap name = CUPS
syslog = 1
syslog only = yes
; NOTE: If you need access to the user home directories uncomment the
; lines below and adjust the settings to your hearts content.
;[homes]
;valid users = %S
;create mode = 0600
;directory mode = 0755
;browseable = no
;read only = no
;veto files = /*.{*}/.*/mail/bin/
; NOTE: Only needed if you run samba as a primary domain controller.
; Not needed as this config doesn’t cover that matter.
;[netlogon]
;path = /var/lib/samba/netlogon
;admin users = Administrator
;valid users = %U
;read only = no
; NOTE: Again – only needed if you’re running a primary domain controller.
;[Profiles]
;path = /var/lib/samba/profiles
;valid users = %U
;create mode = 0600
;directory mode = 0700
;writeable = yes
;browseable = no
; NOTE: Inside this place you may build a printer driver repository for
; Windows – I’ll cover this topic in another HOWTO.
[print$]
path = /var/lib/samba/printers
browseable = yes
guest ok = yes
read only = yes
write list = root
create mask = 0664
directory mask = 0775
[printers]
path = /tmp
printable = yes
guest ok = yes
browseable = no
; Uncomment if you need to share your CD-/DVD-ROM Drive
;[DVD-ROM Drive]
;path = /media/cdrom
;browseable = yes
;read only = yes
;guest ok = yes
[MyFiles]
path = /media/samba/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = YOUR_USERNAME
force group = YOUR_USERGROUP
Sigur ca trebuie facute cateva mici modificari:
netbios name = YOUR_HOSTNAME trebuie inlocuit cu HOSTNAME-ul tau
workgroup = YOUR_WORKGROUP trebuie inlocuit cu WORKGROUP-ul tau (cel care e setat si pe Windows). In general, pe Windows, numele workgrupului este: WORKGROUP sau MSHOME.
wins support = yes
Daca nu ai IP static, sau din diferite motive folosesti un IP dimanic, optiunea de mai sus trebuie setata cu “no” in loc de “yes”.
[MyFiles] este numele share-ului.Poate fi redenumit oricum, insa ar trebui evitate spatiile ( ca de altfel si la celelalte denumiri).
path = /media/samba/ presupunem ca acest path e un HDD mounted sau o alta partitie, si e locul unde vor fi salvate fisierele share-uite.
In cazul in care nu si un alt harddisk la dispozitie, sau o alta partitie, se poate crea un folder pe Home de exemplu, in care se pot tine fisierele share-uite:
#sudo mkdir /home/samba
In acest caz, path-ul va fi:
#path = /home/samba/
Deoarece /home/samba va fi un folder in care va trebui sa scrie mai multe lume, ii vom acorda permisiunile corecte:
#sudo chmod 0777 /home/samba
Cam astea ar fi setarile, trebuie sa pormin serviciul acum:
#sudo /etc/init.d/samba start
Mai trebuie adaugati userii.
In primul rand, pentru a seta cu succes Samba, trebuie ca masina pe care ruleaza linux sa aibe IP static. In caz contrar, nu vei putea folosi WINS…
Se instaleaza Samba:
#sudo apt-get install samba
Dupa instalare, trebuie sa ne asiguram ca Samba nu ruleaza:
#sudo /etc/init.d/samba stop
smb.conf este fisierul de configurare al Samba. Vom redenumi acest fisier in cele ce urmeaza:
#sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.template
Cu urmatoarea comanda vom crea un fisier nou:
#sudo touch /etc/samba/smb.conf
Dupa care vom edita noul fisier in editorul preferat:
#sudo gedit /etc/samba/smb.conf
Cam asta ar trebui pus in noul fisier:
[global]
; General server settings
netbios name = YOUR_HOSTNAME
server string =
workgroup = YOUR_WORKGROUP
announce version = 5.0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
passdb backend = tdbsam
security = user
null passwords = true
username map = /etc/samba/smbusers
name resolve order = hosts wins bcast
wins support = yes
printing = CUPS
printcap name = CUPS
syslog = 1
syslog only = yes
; NOTE: If you need access to the user home directories uncomment the
; lines below and adjust the settings to your hearts content.
;[homes]
;valid users = %S
;create mode = 0600
;directory mode = 0755
;browseable = no
;read only = no
;veto files = /*.{*}/.*/mail/bin/
; NOTE: Only needed if you run samba as a primary domain controller.
; Not needed as this config doesn’t cover that matter.
;[netlogon]
;path = /var/lib/samba/netlogon
;admin users = Administrator
;valid users = %U
;read only = no
; NOTE: Again – only needed if you’re running a primary domain controller.
;[Profiles]
;path = /var/lib/samba/profiles
;valid users = %U
;create mode = 0600
;directory mode = 0700
;writeable = yes
;browseable = no
; NOTE: Inside this place you may build a printer driver repository for
; Windows – I’ll cover this topic in another HOWTO.
[print$]
path = /var/lib/samba/printers
browseable = yes
guest ok = yes
read only = yes
write list = root
create mask = 0664
directory mask = 0775
[printers]
path = /tmp
printable = yes
guest ok = yes
browseable = no
; Uncomment if you need to share your CD-/DVD-ROM Drive
;[DVD-ROM Drive]
;path = /media/cdrom
;browseable = yes
;read only = yes
;guest ok = yes
[MyFiles]
path = /media/samba/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = YOUR_USERNAME
force group = YOUR_USERGROUP
Sigur ca trebuiesc facute cateva mici modificari:
netbios name = YOUR_HOSTNAME trebuie inlocuit cu HOSTNAME-ul tau
workgroup = YOUR_WORKGROUP trebuie inlocuit cu WORKGROUP-ul tau (cel care e setat si pe Windows). In general, pe o masina Windows, numele workgrupului este: WORKGROUP sau MSHOME.
wins support = yes
Daca nu ai IP static, sau din diferite motive folosesti un IP dimanic, optiunea de mai sus trebuie setata cu “no” in loc de “yes”.
[MyFiles] este numele share-ului.Poate fi redenumit oricum, insa ar trebui evitate spatiile ( ca de altfel si la celelalte denumiri).
path = /media/samba/ presupunem ca acest path e un HDD mounted sau o alta partitie, si e locul unde vor fi salvate fisierele share-uite.
In cazul in care nu si un alt harddisk la dispozitie, sau o alta partitie, se poate crea un folder pe Home de exemplu, in care se pot tine fisierele share-uite:
#sudo mkdir /home/samba
In acest caz, path-ul va fi:
#path = /home/samba/
Deoarece /home/samba va fi un folder in care va trebui sa scrie mai multe lume, ii vom acorda permisiunile corecte:
#sudo chmod 0777 /home/samba
Cam astea ar fi setarile, trebuie sa pormin serviciul acum:
#sudo /etc/init.d/samba start
Mai trebuiesc adaugati userii, insa asta data viitoare.Samba este un soft open source, care permite sistemelor de operare unix-based sa “se vada” in retea cu Pc-urile cu Windows. Samba este de fapt implementarea mai multor protocoale intr-un singur soft capabil sa comunice simultan cu aceste protocoale: SMB, TCP/IP, NetBIOS (protocolul implementat in Network Neighborhood din Windows), WINS si Active Directory (pt asta trebuie setat kerberos).
In primul rand, pentru a seta cu succes Samba, trebuie ca masina pe care ruleaza linux sa aibe IP static. In caz contrar, nu vei putea folosi WINS…
Se instaleaza Samba:
#sudo apt-get install samba
Dupa instalare, trebuie sa ne asiguram ca Samba nu ruleaza:
#sudo /etc/init.d/samba stop
smb.conf este fisierul de configurare al Samba. Vom redenumi acest fisier in cele ce urmeaza:
#sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.template
Cu urmatoarea comanda vom crea un fisier nou:
#sudo touch /etc/samba/smb.conf
Dupa care vom edita noul fisier in editorul preferat:
#sudo gedit /etc/samba/smb.conf
Cam asta ar trebui pus in noul fisier:
[global]
; General server settings
netbios name = YOUR_HOSTNAME
server string =
workgroup = YOUR_WORKGROUP
announce version = 5.0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
passdb backend = tdbsam
security = user
null passwords = true
username map = /etc/samba/smbusers
name resolve order = hosts wins bcast
wins support = yes
printing = CUPS
printcap name = CUPS
syslog = 1
syslog only = yes
; NOTE: If you need access to the user home directories uncomment the
; lines below and adjust the settings to your hearts content.
;[homes]
;valid users = %S
;create mode = 0600
;directory mode = 0755
;browseable = no
;read only = no
;veto files = /*.{*}/.*/mail/bin/
; NOTE: Only needed if you run samba as a primary domain controller.
; Not needed as this config doesn’t cover that matter.
;[netlogon]
;path = /var/lib/samba/netlogon
;admin users = Administrator
;valid users = %U
;read only = no
; NOTE: Again – only needed if you’re running a primary domain controller.
;[Profiles]
;path = /var/lib/samba/profiles
;valid users = %U
;create mode = 0600
;directory mode = 0700
;writeable = yes
;browseable = no
; NOTE: Inside this place you may build a printer driver repository for
; Windows – I’ll cover this topic in another HOWTO.
[print$]
path = /var/lib/samba/printers
browseable = yes
guest ok = yes
read only = yes
write list = root
create mask = 0664
directory mask = 0775
[printers]
path = /tmp
printable = yes
guest ok = yes
browseable = no
; Uncomment if you need to share your CD-/DVD-ROM Drive
;[DVD-ROM Drive]
;path = /media/cdrom
;browseable = yes
;read only = yes
;guest ok = yes
[MyFiles]
path = /media/samba/
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
force user = YOUR_USERNAME
force group = YOUR_USERGROUP
Sigur ca trebuiesc facute cateva mici modificari:
netbios name = YOUR_HOSTNAME trebuie inlocuit cu HOSTNAME-ul tau
workgroup = YOUR_WORKGROUP trebuie inlocuit cu WORKGROUP-ul tau (cel care e setat si pe Windows). In general, pe o masina Windows, numele workgrupului este: WORKGROUP sau MSHOME.
wins support = yes
Daca nu ai IP static, sau din diferite motive folosesti un IP dimanic, optiunea de mai sus trebuie setata cu “no” in loc de “yes”.
[MyFiles] este numele share-ului.Poate fi redenumit oricum, insa ar trebui evitate spatiile ( ca de altfel si la celelalte denumiri).
path = /media/samba/ presupunem ca acest path e un HDD mounted sau o alta partitie, si e locul unde vor fi salvate fisierele share-uite.
In cazul in care nu si un alt harddisk la dispozitie, sau o alta partitie, se poate crea un folder pe Home de exemplu, in care se pot tine fisierele share-uite:
#sudo mkdir /home/samba
In acest caz, path-ul va fi:
#path = /home/samba/
Deoarece /home/samba va fi un folder in care va trebui sa scrie mai multe lume, ii vom acorda permisiunile corecte:
#sudo chmod 0777 /home/samba
Cam astea ar fi setarile, trebuie sa pormin serviciul acum:
#sudo /etc/init.d/samba start
Mai trebuiesc adaugati userii, insa asta data viitoare.

(14 votes, average: 4.86 out of 5)






















