Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
utilisateurs:hypathie:tutos:samba [13/09/2014 11:30] Hypathie [Pour aller plus loin] |
utilisateurs:hypathie:tutos:samba [13/09/2014 14:44] Hypathie [Introduction] |
||
---|---|---|---|
Ligne 25: | Ligne 25: | ||
* __Le nom du système hôte sur lequel va être installé samba__ : | * __Le nom du système hôte sur lequel va être installé samba__ : | ||
<code user>hostname</code> | <code user>hostname</code> | ||
- | <code>debian-1</code> | + | <code>debian-serveur</code> |
>Attention à la confusion entre serveur (samba ou autre) installé sur un système qui reste malgré tout "l'hôte", on va dire de ce système. | >Attention à la confusion entre serveur (samba ou autre) installé sur un système qui reste malgré tout "l'hôte", on va dire de ce système. | ||
Ligne 32: | Ligne 32: | ||
<code> | <code> | ||
<...> | <...> | ||
- | inet 192.168.0.15/24 brd 192.168.0.255 | + | 192.168.0.14/24 brd 192.168.0.255 |
<...> | <...> | ||
</code> | </code> | ||
Ligne 39: | Ligne 39: | ||
* __L'utilisateur principal du système__ : | * __L'utilisateur principal du système__ : | ||
<code root>echo $USER</code> | <code root>echo $USER</code> | ||
- | <code>first-user</code> | + | <code>hypathie</code> |
====Pré-requis ==== | ====Pré-requis ==== | ||
Ligne 45: | Ligne 45: | ||
===Création d'un compte user pour le partage de fichier=== | ===Création d'un compte user pour le partage de fichier=== | ||
- | <code root>addgroup --system hypathie</code> | + | <code root>addgroup --system sharing</code> |
===Création d'un utilisateur système correspondant à l'utilisateur samba === | ===Création d'un utilisateur système correspondant à l'utilisateur samba === | ||
- | <code root>adduser --system hypathie --ingroup hypathie</code> | + | <code root>adduser --system sharing --ingroup sharing</code> |
+ | |||
+ | ===Mot de passe système unix === | ||
+ | <code root>passwd sharing</code> | ||
===Création d'un fichier partageable === | ===Création d'un fichier partageable === | ||
- | <code root>mkdir /home/hypathie/public</code> | + | <code root>mkdir /home/sharing/public</code> |
- | ===Mise en place des droits sur le répertoire et ses fichiers partageable === | + | ===Mise en place des droits sur le répertoire et ses fichiers partageables === |
- | <code root>chown -R hypathie:hypathie /home/hypathie/</code> | + | <code root>chown -R sharing:sharing /home/hypathie/</code> |
- | <code root>chmod -R 770 /home/hypathie/</code> | + | <code root>chmod -R 770 /home/sharing/</code> |
- | > Pour donner les droits récursivement à /home/hypathie/public | + | > Pour donner les droits récursivement à /home/sharing/public |
Ligne 86: | Ligne 89: | ||
[global] | [global] | ||
- | workgroup = WORKGROUP # par défaut et à laisser tel quel | ||
- | netbios name = debian-1 # nom du serveur visible sur le poste client Windows | ||
- | server string = %h server # nom du serveur samba | + | workgroup = WORKGROUP # par défaut et à laisser tel quel |
+ | netbios name = debian-serveur # nom du serveur visible sur le poste client Windows | ||
- | hosts allow = 192.168.0. 127. # ajouté et à modifier selon l'IP du réseau local | + | server string = %h SAMBA # nom du serveur samba |
+ | path = /home/sharing | ||
+ | valid user = sharing | ||
- | security = user # à décommenter | + | #### Networking #### |
- | + | ||
- | bind interfaces only = yes # mettre "yes" pour utiliser le choix des interfaces (ligne au dessous) | + | |
- | interfaces = 192.168.0.15/24 # Pour éviter le wifi, on peut mettre à la place de l'IP/masque, le nom de l'interface "eth0:0" | + | |
+ | interfaces = 192.168.0.14 eth0 | ||
+ | hosts allow = 192.168.0. 127. | ||
- | [hypathie] # ajouté et à modifier selon le répertoire de partage | + | |
- | path = /home/hypathie/ # créé sur le système lors de la création d'un nouvel utilisateur | + | ####### Authentication ####### |
- | read only = no | + | |
+ | security = user | ||
+ | encrypt passwords = true | ||
+ | |||
+ | ########## Printing ########## | ||
+ | |||
+ | ; printing = bsd | ||
+ | ; printcap name = /etc/printcap | ||
+ | |||
+ | printing = cups | ||
+ | printcap name = cups | ||
+ | |||
+ | use client driver = yes | ||
+ | |||
+ | |||
+ | #======================= Share Definitions ======================= | ||
+ | |||
+ | [homes] | ||
+ | comment = Home Directories | ||
+ | browseable = no | ||
+ | |||
+ | # next parameter to 'no' if you want to be able to write to them. | ||
+ | read only = yes | ||
+ | |||
+ | create mask = 0700 | ||
+ | |||
+ | directory mask = 0700 | ||
+ | |||
+ | # By default, \\server\username shares can be connected to by anyone | ||
+ | # with access to the samba server. | ||
+ | # The following parameter makes sure that only "username" can connect | ||
+ | # to \\server\username | ||
+ | # This might need tweaking when using external authentication schemes | ||
+ | valid users = %S | ||
+ | |||
+ | |||
+ | [sharing] | ||
+ | path = /home/sharing/ | ||
browseable = yes | browseable = yes | ||
writeable = yes | writeable = yes | ||
- | valid users = hypathie | + | valid users = sharing |
- | write list = hypathie | + | write list = sharing |
- | create mask = 0700 # droits posix (octal = 0 devant 700): lecture, écriture, exécution pour l'utilisateur seulement | + | create mask = 0770 |
- | directory = 700 | + | directory mask = 700 |
- | force user = nobody # surtout si on partage la racine | + | |
- | force group = nogroup | + | |
</code> | </code> | ||
+ | |||
+ | |||
<note tip> | <note tip> | ||
**__Le fichier ''/etc/samba/smb.conf'' est constitué par section.__**\\ | **__Le fichier ''/etc/samba/smb.conf'' est constitué par section.__**\\ | ||
Ligne 311: | Ligne 351: | ||
===Accès au répertoire partagé du serveur === | ===Accès au répertoire partagé du serveur === | ||
+ | FIXME | ||
+ | |||
- | <code user>smbclient //@192.168.0.15/home/hypathie -U hypathie</code> | ||
On peut alors avoir accès au dossiers partagés et y faire ce qu'on veut avec les commandes smbclient. | On peut alors avoir accès au dossiers partagés et y faire ce qu'on veut avec les commandes smbclient. | ||
Ligne 325: | Ligne 366: | ||
===Édition du fichier /etc/samba/smb.conf === | ===Édition du fichier /etc/samba/smb.conf === | ||
Il doit ressembler à cela. | Il doit ressembler à cela. | ||
- | <code>########## Printing ########## | + | <code>[printers] |
- | + | comment = All Printers | |
- | # If you want to automatically load your printer list rather | + | browseable = yes |
- | # than setting them up individually then you'll need this | + | printable = yes |
- | ; load printers = yes | + | writeable = no |
- | + | guest ok = no | |
- | # lpr(ng) printing. You may wish to override the location of the | + | read only = yes |
- | # printcap file | + | create mask = 0700 |
- | ; printing = bsd | + | |
- | ; printcap name = /etc/printcap | + | |
- | + | ||
- | # CUPS printing. See also the cupsaddsmb(8) manpage in the | + | |
- | # cupsys-client package. | + | |
- | printing = cups | + | |
- | printcap name = cups | + | |
- | + | ||
- | use client driver = yes | + | |
- | + | ||
- | [printers] | + | |
- | browseable = no | + | |
- | printable = yes | + | |
- | writable = no | + | |
- | guest ok = yes | + | |
- | comment = All Printers | + | |
- | public = yes | + | |
- | printer admin = root | + | |
- | + | ||
- | [print$] | + | |
- | guest ok = no | + | |
- | comment = Printer Drivers | + | |
- | writable = no | + | |
- | path = /etc/samba/drivers | + | |
- | write list = root @ntadmin | + | |
+ | # Windows clients look for this share name as a source of downloadable | ||
+ | # printer drivers | ||
+ | [print$] | ||
+ | comment = Printer Drivers | ||
+ | path = /var/lib/samba/printers | ||
+ | browseable = yes | ||
+ | writeable = no | ||
+ | read only = yes | ||
+ | guest ok = no | ||
+ | # Uncomment to allow remote administration of Windows print drivers. | ||
+ | # You may need to replace 'lpadmin' with the name of the group your | ||
+ | # admin users are members of. | ||
+ | # Please note that you also need to set appropriate Unix permissions | ||
+ | # to the drivers directory for these users to have write rights in it | ||
+ | write list = root, @lpadmin | ||
</code> | </code> | ||