Installation d'un serveur de partage de fichier
STATUS:PAGE LOADED — 2021-05-01

Installation d'un serveur de partage de fichier.

2 clés usb sont insérer dans le hub usb :

pi@raspberrypi ~ $ sudo apt-get install samba samba-common-bin

2) Vérification des espaces de stockage : * L'espace de stockage externe ayant un système de fichier linux formater en "ext3fs".

pi@raspberrypi ~ $ sudo fdisk -l
...
Disk /dev/sda: 16.0 GB, 16025387008 bytes
255 heads, 63 sectors/track, 1948 cylinders, total 31299584 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000f68f
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    31299583    15648768   83  Linux
pi@raspberrypi ~ $ ls -l /media/stockage/partage/
total 0
-rw-r--r-- 1 root root 0 avril 23 23:00 partage.txt

* L'espace de stockage externe ayant un système de fichier windows formater en "vfat".

pi@raspberrypi ~ $ sudo fdisk -l
...
Disk /dev/sdb: 16.0 GB, 16039018496 bytes
255 heads, 63 sectors/track, 1949 cylinders, total 31326208 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf4ed403c
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              63    31310684    15655311    b  W95 FAT32

Nom donnée lors d'un précédent formatage de la clé usb : "windows" La clé est directement monté.

pi@raspberrypi ~ $ ls -l /media/windows/
total 0

3) Création de l'utilisateur "invite" linux pour l'accés à espace de stockage partagé :

pi@raspberrypi ~ $ sudo adduser invite --home=/home/invite --shell=/bin/false --disabled-password

4) Création de l'utilisateur "invite" samba :

pi@raspberrypi ~ $ sudo smbpasswd -a invite
New SMB password: <mot2passe>
Retype new SMB password: <mot2passe>
Added user invite.

5) Changement des droits de l'espace de stockage partagé :

pi@raspberrypi ~ $ sudo chown -R invite:invite /media/stockage/partage/

6) Ajouter un partage à Samba : Ouvrir :

/etc/samba/smb.conf

Chercher :

   workgroup = WORKGROUP

Remplacer par :

   workgroup = RASPBERRYPI

Ajouter à la fin :

Partage d'un espace de stockage linux formaté en "ext3fs"

[Partage]
comment = Partage
read only = no
writable = yes
locking = no
path = /media/stockage/partage/
guest ok = yes
force user = invite
create mask = 0777
directory mask = 0777

Ajouter à la fin :

Partage d'un espace de stockage windows formaté en "vfat"

[PartageWin]
comment = PartageWin
read only = no
writable = yes
locking = no
path = /media/windows
guest ok = yes
force user = invite
create mask = 0777
directory mask = 0777

7) Relancer le service Samba :

pi@raspberrypi ~ $ sudo service samba restart
[ ok ] Stopping Samba daemons: nmbd smbd.
[ ok ] Starting Samba daemons: nmbd smbd.

8) Vérification du fichier de configuration :

pi@raspberrypi ~ $ testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Partage]"
Loaded services file OK.
WARNING: 'workgroup' and 'netbios name' must differ.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
    workgroup = RASPBERRYPI
    server string = %h server
    map to guest = Bad User
    obey pam restrictions = Yes
    pam password change = Yes
    passwd program = /usr/bin/passwd %u
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    unix password sync = Yes
    syslog = 0
    log file = /var/log/samba/log.%m
    max log size = 1000
    dns proxy = No
    usershare allow guests = Yes
    panic action = /usr/share/samba/panic-action %d
    idmap config * : backend = tdb
[homes]
    comment = Home Directories
    valid users = %S
    create mask = 0700
    directory mask = 0700
    browseable = No
...
[Partage]
    comment = Partage
    path = /media/stockage/partage/
    force user = invite
    read only = No
    create mask = 0777
    directory mask = 0777
    guest ok = Yes
    locking = No
[PartageWin]
    comment = PartageWin
    path = /media/windows
    force user = invite
    read only = No
    create mask = 0777
    directory mask = 0777
    guest ok = Yes
    locking = No

9) Démonter la partition de la clé usb :

pi@raspberrypi ~ $ sudo umount /media/windows

10) Créer un répertoire de montage spécifique à windows:

pi@raspberrypi ~ $ sudo mkdir /media/windows

11) Modifier la configuration de montage par défaut de la clé usb windows : Ouvrir :

/etc/fstab

Ajouter à la fin :

/dev/sdb1       /media/windows  vfat       defaults    0       2

12) Rédemmarrer le RPi. 13) Vérification du montage de la clé usb windows :

pi@raspberrypi ~ $ ls -l /media/
total 12
drwxr-xr-x 5 root root 4096 avril 24 19:15 stockage
drwxr-xr-x 4 root root 8192 janv.  1  1970 windows

14) Vérification du partage distant à partir d'un ordinateur distant :

[~] ➔ smbclient -L 192.168.1.19
Enter util01's password: <mot2passe>
Domain=[RASPBERRYPI] OS=[Unix] Server=[Samba 3.6.6]
    Sharename       Type      Comment
    ---------       ----      -------
    print$          Disk      Printer Drivers
    Partage         Disk      Partage
    PartageWin      Disk      PartageWin
    IPC$            IPC       IPC Service (raspberrypi server)
Domain=[RASPBERRYPI] OS=[Unix] Server=[Samba 3.6.6]
    Server               Comment
    ---------            -------
    RASPBERRYPI          raspberrypi server
    Workgroup            Master
    ---------            -------
    RASPBERRYPI          RASPBERRYPI
    RESEAU01             STATION73
    WORKGROUP            LIVEBOX

15) Connexion au partage distant sous format linux avec Debian Squeeze en mode graphique :

  • [Raccourcis]
  • [Se connecteur à un serveur...] * Configuration de "Connexion au serveur" :
Type de service : Partage Windows
Serveur : 192.168.1.19
Partage : Partage
Dossier :
Identifiant : invite
Nom de domaine : raspberrypi
Ajouter un signet : V
Nom du signet : RaspberryPi
  • [Se connecter]
  • Mot de passe : mot2passe "Se souvenir pour toujours" : V 16) Connexion au partage distant sous format linux avec Debian Squeeze en ligne de commande :
[~] ➔ smbclient \\\\192.168.1.19\\Partage -U invite
Enter invite's password: <mot2passe>
Domain=[RASPBERRYPI] OS=[Unix] Server=[Samba 3.6.6]
smb: \> ls
  .                                   D        0  Tue Apr 23 23:32:35 2013
  ..                                  D        0  Tue Apr 23 23:00:25 2013
  partage.txt                                  0  Tue Apr 23 23:00:58 2013
  BomberX_01.mkv                      A 500385230  Fri Apr  5 21:55:21 2013
        60167 blocks of size 262144. 32784 blocks available
smb: \>

16) Connexion à partir d'un ordinateur Debian Squeeze en ligne de commande :

[~] ➔ smbclient \\\\192.168.1.19\\PartageWin -U invite
Enter invite's password: <mot2passe>
Domain=[RASPBERRYPI] OS=[Unix] Server=[Samba 3.6.6]
smb: \> cd hb
smb: \hb\> ls
  .                                   D        0  Fri Dec 21 13:56:42 2012
  ..                                  D        0  Thu Jan  1 01:00:00 1970
  the_binding_of_isaac_wrath_of_the_lamb-linux-20121219-i386.deb      A 40834094  Fri Dec 21 13:00:56 2012
  Snapshot-linux-v28-x86.tar.gz       A 267569155  Fri Dec 21 13:01:28 2012
  LegendOfGrimrock-Linux-2012-12-18.sh      A 316750312  Fri Dec 21 12:56:46 2012
  the_binding_of_isaac_wrath_of_the_lamb-linux-1.48-1355426233.swf.zip      A 33249260  Fri Dec 21 13:00:58 2012
  snapshot-linux-28-i386.deb          A 267018592  Fri Dec 21 13:01:36 2012
  Closure-Linux-1.1-2012-12-18.sh      A 318395935  Fri Dec 21 12:55:18 2012
  the_binding_of_isaac_wrath_of_the_lamb-linux.tar.gz      A 40812021  Fri Dec 21 13:00:54 2012
  shank2-linux-b10.tar.gz             A 1715540474  Fri Dec 21 13:00:08 2012
  indiegamethemovie_1080p.zip         A 2608505902  Fri Dec 21 13:31:28 2012
  indiegamethemovie_720p.zip          A 1401988610  Fri Dec 21 13:24:22 2012
        61093 blocks of size 262144. 17094 blocks available
smb: \hb\>