Partage
  • Partager sur Facebook
  • Partager sur Twitter

montez-un-serveur-de-fichiers-sous-linux

    12 septembre 2021 à 15:03:06

    Bonjour,

    je suis le cours "montez-un-serveur-de-fichiers-sous-linux" d'Openclassroom et en suis à la partie "Partagez vos fichiers sur un réseau hétérogène avec Samba".

    Le client et le serveur sont respectivement Ubuntu-Desktop 20.04 et Ubuntu-Server 20.04 (mis à jour).

    Ça se passe ici: https://openclassrooms.com/fr/courses/2356316-montez-un-serveur-de-fichiers-sous-linux/5173636-partagez-vos-fichiers-sur-un-reseau-heterogene-avec-samba

    Tout ce qui est décrit fonctionne correctement.

    Cela dit, d'autres possibilités sont évoquées, sans les traiter (ce que je peux comprendre, le cours est là pour se faire une idée). Et c'est là que mes questions interviennent…

    J'ai deux questions:

    1) Après avoir monté manuellement le dossier partagé (du serveur) sur le dossier concerné (du client), il est indiqué que help nous propose des commandes avec lesquelles on peut jouer…

    ** Aucun montage n'est fait avec fstab (j'ai commenté les lignes //vm-serveur/…, puis j'ai lancé un mount -a …, les pare-feux sont stoppés sur le serveur ainsi que chez le client)

    ** J'essaie la commande put avec juste un nom de fichier en paramètre:

    thierry@vm-client:~$ pwd
    /home/thierry
    thierry@vm-client:~$ ls
    Bilder             hosts                 ipsec-PSK-XAUTH.conf                 openssl-certificat           test_samba_client
    caCert.der         ike_log               ipsec-PSK-XAUTH.secrets              pki-strongswan               Videos
    client1.ovpn       ipsec.conf            ipsec.secrets                        Schreibtisch                 Vorlagen
    client.ipsec.conf  ipsec-PSK-ah.conf     ipsec-Zertifikat-PKI-rsasig.conf     server-client.ipsec.secrets
    Dokumente          ipsec-PSK-ah.secrets  ipsec-Zertifikat-PKI-rsasig.secrets  server.ipsec.conf
    Downloads          ipsec-PSK.conf        Musik                                snap
    easy-rsa           ipsec-PSK.secrets     Öffentlich                           strongswan
    thierry@vm-client:~$ smbclient -U thierry //vm-serveur/home
    Enter WORKGROUP\thierry's password: 
    Try "help" to get a list of possible commands.
    smb: \> put ike_log
    putting file ike_log as \ike_log (45821,0 kb/s) (average 45821,1 kb/s)
    smb: \> 
    

    ** Résultat côté serveur (c'est ok):

    root@vm-serveur:/export/home/thierry# ll
    total 1936
    drwxr-xr-x 2 thierry thierry    4096 Sep 12 12:25 ./
    drwxr-xr-x 5 root    root       4096 Sep 12 10:35 ../
    -rwxrw-r-- 1 thierry thierry       0 Sep 12 11:53 fichiersambahome*
    -rwxrw-r-- 1 thierry thierry 1970672 Sep 12 12:25 ike_log*
    -rwxrw-r-- 1 thierry thierry       0 Sep 11 17:05 testSamba*
    


    ** Et maintenant le drame:

    smb: \> put /home/thierry/ipsec.conf 
    NT_STATUS_OBJECT_PATH_NOT_FOUND opening remote file \home\thierry\ipsec.conf
    smb: \> 
    


    Est-il nécessaire du coté du client de se trouver dans le répertoire duquel on veut envoyé un fichier ? Ou bien existe-t-il une syntaxe particulière pour pouvoir utiliser un chemin absolu ?

    2) J'utilise maintenant le fichier /etc/fstab pour monter mes dossiers partagés samba dans le client:

    root@vm-client:~# mount -a
    root@vm-client:~# mount | grep //vm
    //vm-serveur/shared on /mnt/samba/shared type cifs (rw,relatime,vers=3.1.1,sec=none,cache=strict,uid=1000,noforceuid,gid=1000,noforcegid,addr=192.168.29.1,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,_netdev)
    //vm-serveur/home on /mnt/samba/home type cifs (rw,relatime,vers=3.1.1,cache=strict,username=thierry,uid=1000,noforceuid,gid=1000,noforcegid,addr=192.168.29.1,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)
    root@vm-client:~# 
    

    Si quelqu'un d'autre que thierry (albertine par exemple)  se connecte à cet ordinateur et souhaite également accéder à un dossier home (le sien) distant.

    Il va falloir sur le client créer un dossier (spécifique à albertine) sur lequel sera monté le home distant d'albertine (issu du serveur), c'est correct ? Puis créer une nouvelle ligne dans /etc/fstab pour albertine, c'est correct ?

    Existe-t-il d'autres moyens pour configurer tout cela au sein d'un même ordinateur client ?

    ===========================================================================

    Config (serveur):

    root@vm-serveur:/export/home# ll
    total 32
    drwxr-xr-x 5 root      root     4096 Sep 12 10:35 ./
    drwxr-xr-x 4 root      root     4096 Sep  9 10:07 ../
    drwx------ 2 root      root    16384 Sep 10 14:47 lost+found/
    drwxr-xr-x 2 sambatest root     4096 Sep 12 10:35 sambatest/
    drwxr-xr-x 2 thierry   thierry  4096 Sep 12 12:25 thierry/
    root@vm-serveur:/export/home# cd ..
    root@vm-serveur:/export# ll
    total 16
    drwxr-xr-x  4 root   root    4096 Sep  9 10:07 ./
    drwxr-xr-x 21 root   root    4096 Sep  9 10:06 ../
    drwxr-xr-x  5 root   root    4096 Sep 12 10:35 home/
    drwxr-xr-x  3 nobody nogroup 4096 Sep 12 11:54 shared/
    
    root@vm-serveur:/export/home/thierry# tree /export
    /export
    ├── home
    │   ├── lost+found
    │   ├── sambatest
    │   └── thierry
    │       ├── fichiersambahome
    │       ├── ike_log
    │       └── testSamba
    └── shared
        ├── fichier_10M
        ├── fichier_5M
        ├── fichiersambashared
        ├── lost+found
        ├── testSambaShared
        └── test_shared
    
    6 directories, 8 files
    root@vm-serveur:/export/home/thierry# cat /etc/samba/smb.conf | grep -v "#" | grep -v ";"
    
    
    [global]
    
       workgroup = WORKGROUP
    
       server string = %h server (Samba, Ubuntu)
    
       interfaces = 127.0.0.0/8 enp0s8
    
       bind interfaces only = yes
    
       log file = /var/log/samba/log.%m
    
       max log size = 1000
    
       logging = file
    
       panic action = /usr/share/samba/panic-action %d
    
       server role = standalone server
    
       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
    
       usershare allow guests = yes
    
    [home]
            path = /export/home/%u
            read only = no
            guest ok = no
            force create mode = 0660
            force directory mode = 2770
            valid users = @sambashare
    
    [shared]
            path = /export/shared
            read only = no
            guest ok = yes
            force user = nobody
            force group = nogroup
            force create mode = 0660
            force directory mode = 2770

    root@vm-serveur:/export/home/thierry# pdbedit -L
    nobody:65534:nobody
    thierry:1000:thierry
    sambatest:1002:
    trang:1001:
    


    Config (Client):

    thierry@vm-client:~$ cat /etc/fstab
    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a
    # device; this may be used with UUID= as a more robust way to name devices
    # that works even if disks are added and removed. See fstab(5).
    #
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    # / was on /dev/sda5 during installation
    UUID=bcaef36c-c7c9-459c-93be-fb12bbf06544 /               ext4    errors=remount-ro 0       1
    # /boot/efi was on /dev/sda1 during installation
    UUID=A280-B1AF  /boot/efi       vfat    umask=0077      0       1
    /swapfile                                 none            swap    sw              0       0
    #
    #
    #       NFS4:
    vm-serveur:/    /mnt/reseau     nfs4    rw,hard,intr,_netdev    0       0
    #
    #
    #       SAMBA:
    //vm-serveur/shared     /mnt/samba/shared       cifs    rw,guest,uid=thierry,gid=thierry,_netdev        0       0
    //vm-serveur/home       /mnt/samba/home cifs    rw,uid=thierry,gid=thierry,credentials=/root/.credentials       0       0
    thierry@vm-client:~$ ll /mnt/samba
    insgesamt 8
    drwxr-xr-x 4 root    root    4096 Sep 11 18:54 ./
    drwxr-xr-x 4 root    root    4096 Sep 12 13:46 ../
    drwxr-xr-x 2 thierry thierry    0 Sep 12 14:25 home/
    drwxr-xr-x 2 thierry thierry    0 Sep 12 13:54 shared/
    



    -
    Edité par DenebeDenebe 12 septembre 2021 à 15:03:34

    • Partager sur Facebook
    • Partager sur Twitter

    montez-un-serveur-de-fichiers-sous-linux

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown