Publié le

Installer samba4 sur archlinux

Le but est installer samba4 et faire une configuration simple pour partager des archives, lire des commentaires:

2013-03-05 Samba works!

capture d'écran samba

2012-03-12 depuis windows XP pro avec l’utile de administration du serveur samba:
screen-samba-active-directory

À propos de Fredy Rouge

Leader, Créatif, Autodidacte et Geek ☺

31 réponses à “Installer samba4 sur archlinux

  1. SMB fonctionne, photo dessus :)

    Il manque l’annoncer pour le faire visible aux autres.

  2. Essai du Kerberos:

    [root@pdc ~]# kinit administrator@LAN.CCLCDN.QC.CA
    Password for administrator@LAN.CCLCDN.QC.CA: 
    Warning: Your password will expire in 34 days on Tue 09 Apr 2013 05:39:56 PM EDT
    [root@pdc ~]# klist 
    Ticket cache: FILE:/tmp/krb5cc_0
    Default principal: administrator@LAN.CCLCDN.QC.CA
    
    Valid starting    Expires           Service principal
    05/03/2013 16:49  06/03/2013 02:49  krbtgt/LAN.CCLCDN.QC.CA@LAN.CCLCDN.QC.CA
            renew until 06/03/2013 16:49
    
  3. Testing DNS:

    [fredyrouge@eeepc101 ~]$ host -t SRV _ldap._tcp.lan.cclcdn.qc.ca.
    _ldap._tcp.lan.cclcdn.qc.ca has SRV record 0 100 389 pdc.lan.cclcdn.qc.ca.
    [fredyrouge@eeepc101 ~]$ host -t SRV _kerberos._udp.lan.cclcdn.qc.ca.
    _kerberos._udp.lan.cclcdn.qc.ca has SRV record 0 100 88 pdc.lan.cclcdn.qc.ca.
    [fredyrouge@eeepc101 ~]$ host -t A pdc.lan.cclcdn.qc.ca.
    pdc.lan.cclcdn.qc.ca has address 192.168.1.127
    
  4. DNS (FW) fonctionne, dans le serveur et dans mon laptop le resolv.conf est:

    domain lan.cclcdn.qc.ca
    nameserver 192.168.2.1

  5. Pour la prochaine fois le devoir est tester le DNS parce que il ne marche pas :(

  6. le resolv.conf:

    [root@pdc etc]# cat resolv_samba4.conf 
    domain lan.cclcdn.qc.ca 
    nameserver 192.168.2.1 
    
    [root@pdc etc]# cat resolv_samba4.conf > resolv.conf 
    

    Parce que dhcpcd (je suis en test mode) eface le resolv.conf

  7. Et voila que l’authentification fonctionne :)

    [fredyrouge@eeepc101 ~]$ smbclient //192.168.1.127/netlogon -UAdministrator%'YourSmbAdmPwd' -c 'ls'
    Domain=[LAN] OS=[Unix] Server=[Samba 4.0.1]
      .                                   D        0  Tue Feb 26 16:39:48 2013
      ..                                  D        0  Tue Feb 26 16:39:58 2013
    
                    56333 blocks of size 262144. 51510 blocks available
    
  8. Le dossier que viens de ajouter été le problème, avant:

    [root@pdc samba]# smbclient -L localhost -U%
    Connection to localhost failed (Error NT_STATUS_CONNECTION_REFUSED)
    

    Maintenant :)

    [root@pdc samba]# smbclient -L localhost -U%
    Domain=[LAN] OS=[Unix] Server=[Samba 4.0.1]
    
            Sharename       Type      Comment
            ---------       ----      -------
            netlogon        Disk      
            sysvol          Disk      
            IPC$            IPC       IPC Service (Samba 4.0.1)
    Domain=[LAN] OS=[Unix] Server=[Samba 4.0.1]
    
            Server               Comment
            ---------            -------
    
            Workgroup            Master
            ---------            -------
    
  9. Il manque un dossier:

    # systemctl status samba
    ...
    Feb 26 16:44:38 pdc smbd[611]: [2013/02/26 16:44:38.101569,  0] ../source3/smbd/server.c:1280(main)
    Feb 26 16:44:38 pdc smbd[611]: standard input is not a socket, assuming -D option
    Feb 26 16:44:41 pdc smbd[611]: [2013/02/26 16:44:41.684392,  0] ../lib/util/util.c:168(directory_create_or_exist)
    Feb 26 16:44:41 pdc smbd[611]: mkdir failed on directory /run/samba/ncalrpc: No such file or directory
    Feb 26 16:44:41 pdc smbd[611]: [2013/02/26 16:44:41.684627,  0] ../source3/smbd/server.c:1464(main)
    Feb 26 16:44:41 pdc smbd[611]: Failed to create pipe directory /run/samba/ncalrpc - No such file or directory
    

    Alors le ajouter:

    # mkdir -p /run/samba/ncalrpc
     
  10. Il existe un groupe CCLCDN sur le réseau du centre, j’ai décide changer le nom:

    systemctl stop samba
    [root@pdc samba]# rm /etc/samba/smb.conf &&  samba-tool domain provision
    Realm: lan.cclcdn.qc.ca
     Domain [lan]: 
     Server Role (dc, member, standalone) [dc]: 
     DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: 
     DNS forwarder IP address (write 'none' to disable forwarding) [192.168.2.1]: 
    Administrator password: 
    Retype password: 
    Looking up IPv4 addresses
    Looking up IPv6 addresses
    No IPv6 address will be assigned
    Setting up secrets.ldb
    Setting up the registry
    Setting up the privileges database
    Setting up idmap db
    Setting up SAM db
    Setting up sam.ldb partitions and settings
    Setting up sam.ldb rootDSE
    Pre-loading the Samba 4 and AD schema
    Adding DomainDN: DC=lan,DC=cclcdn,DC=qc,DC=ca
    Adding configuration container
    Setting up sam.ldb schema
    Setting up sam.ldb configuration data
    Setting up display specifiers
    Adding users container
    Modifying users container
    Adding computers container
    Modifying computers container
    Setting up sam.ldb data
    Setting up well known security principals
    Setting up sam.ldb users and groups
    Setting up self join
    Adding DNS accounts
    Creating CN=MicrosoftDNS,CN=System,DC=lan,DC=cclcdn,DC=qc,DC=ca
    Creating DomainDnsZones and ForestDnsZones partitions
    Populating DomainDnsZones and ForestDnsZones partitions
    Setting up sam.ldb rootDSE marking as synchronized
    Fixing provision GUIDs
    A Kerberos configuration suitable for Samba 4 has been generated at /var/lib/samba/private/krb5.conf
    Once the above files are installed, your Samba4 server will be ready to use
    Server Role:           active directory domain controller
    Hostname:              pdc
    NetBIOS Domain:        LAN
    DNS Domain:            lan.cclcdn.qc.ca
    DOMAIN SID:            S-1-5-21-1627263621-937223665-3157019520
    
    [root@pdc samba]# cat smb.conf 
    # Global parameters
    [global]
            workgroup = LAN
            realm = LAN.CCLCDN.QC.CA
            netbios name = PDC
            server role = active directory domain controller
            dns forwarder = 192.168.2.1
    
    [netlogon]
            path = /var/lib/samba/sysvol/lan.cclcdn.qc.ca/scripts
            read only = No
    
    [sysvol]
            path = /var/lib/samba/sysvol
            read only = No
    
  11. [root@pdc samba]# rm /etc/samba/smb.conf && samba-tool domain provision
    Realm: cclcdn.qc.ca
     Domain [cclcdn]: 
     Server Role (dc, member, standalone) [dc]: 
     DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: 
     DNS forwarder IP address (write 'none' to disable forwarding) [192.168.2.1]: 
    Administrator password: 
    Retype password: 
    Looking up IPv4 addresses
    Looking up IPv6 addresses
    No IPv6 address will be assigned
    Setting up secrets.ldb
    Setting up the registry
    Setting up the privileges database
    Setting up idmap db
    Setting up SAM db
    Setting up sam.ldb partitions and settings
    Setting up sam.ldb rootDSE
    Pre-loading the Samba 4 and AD schema
    Adding DomainDN: DC=cclcdn,DC=qc,DC=ca
    Adding configuration container
    Setting up sam.ldb schema
    Setting up sam.ldb configuration data
    Setting up display specifiers
    Adding users container
    Modifying users container
    Adding computers container
    Modifying computers container
    Setting up sam.ldb data
    Setting up well known security principals
    Setting up sam.ldb users and groups
    Setting up self join
    Adding DNS accounts
    Creating CN=MicrosoftDNS,CN=System,DC=cclcdn,DC=qc,DC=ca
    Creating DomainDnsZones and ForestDnsZones partitions
    Populating DomainDnsZones and ForestDnsZones partitions
    Setting up sam.ldb rootDSE marking as synchronized
    Fixing provision GUIDs
    A Kerberos configuration suitable for Samba 4 has been generated at /var/lib/samba/private/krb5.conf
    Once the above files are installed, your Samba4 server will be ready to use
    Server Role:           active directory domain controller
    Hostname:              pdc
    NetBIOS Domain:        CCLCDN
    DNS Domain:            cclcdn.qc.ca
    DOMAIN SID:            S-1-5-21-2471507525-4074201033-271103703
    
  12. encore une fois:

    # samba-tool domain provision
    Realm: cclcdn.qc.ca
    Domain [cclcdn]:
    Server Role (dc, member, standalone) [dc]:
    DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]:
    DNS forwarder IP address (write ‘none’ to disable forwarding) [192.168.2.1]:
    Administrator password:
    Retype password:
    Looking up IPv4 addresses
    Looking up IPv6 addresses
    No IPv6 address will be assigned
    Setting up share.ldb
    Setting up secrets.ldb
    Setting up the registry
    Setting up the privileges database
    Setting up idmap db
    Setting up SAM db
    Setting up sam.ldb partitions and settings
    Setting up sam.ldb rootDSE
    Pre-loading the Samba 4 and AD schema
    Adding DomainDN: DC=cclcdn,DC=qc,DC=ca
    Adding configuration container
    Setting up sam.ldb schema
    Setting up sam.ldb configuration data
    Setting up display specifiers
    Adding users container
    Modifying users container
    Adding computers container
    Modifying computers container
    Setting up sam.ldb data
    Setting up well known security principals
    Setting up sam.ldb users and groups
    ERROR(ldb): uncaught exception – 0000052D: Constraint violation – check_password_restrictions: the password is too short. It should be equal or longer than 7 characters!
    File "/usr/lib/python2.7/site-packages/samba/netcmd/__init__.py", line 175, in _run
    return self.run(*args, **kwargs)
    File "/usr/lib/python2.7/site-packages/samba/netcmd/domain.py", line 398, in run
    use_rfc2307=use_rfc2307, skip_sysvolacl=False)
    File "/usr/lib/python2.7/site-packages/samba/provision/__init__.py", line 2058, in provision
    skip_sysvolacl=skip_sysvolacl)
    File "/usr/lib/python2.7/site-packages/samba/provision/__init__.py", line 1661, in provision_fill
    next_rid=next_rid, dc_rid=dc_rid)
    File "/usr/lib/python2.7/site-packages/samba/provision/__init__.py", line 1349, in fill_samdb
    "KRBTGTPASS_B64": b64encode(krbtgtpass.encode(‘utf-16-le’))
    File "/usr/lib/python2.7/site-packages/samba/provision/common.py", line 50, in setup_add_ldif
    ldb.add_ldif(data, controls)
    File "/usr/lib/python2.7/site-packages/samba/__init__.py", line 224, in add_ldif
    self.add(msg, controls)

  13. # samba-tool domain provision
    Realm: cclcdn.qc.ca
    Domain: cclcdn
    Server role: dc
    DNS backend: SAMBA_INTERNAL
    DNS Fw Ip addr: 192.168.2.1
    Administrator password:
    Retype password:

    ERROR(<class 'samba.provision.ProvisioningError'>): Provision failed - ProvisioningError: guess_names: 'realm =' was not specified in supplied /etc/samba/smb.conf.  Please remove the smb.conf file and let provision generate it
      File "/usr/lib/python2.7/site-packages/samba/netcmd/domain.py", line 398, in run
        use_rfc2307=use_rfc2307, skip_sysvolacl=False)
      File "/usr/lib/python2.7/site-packages/samba/provision/__init__.py", line 1892, in provision
        sitename=sitename, rootdn=rootdn)
      File "/usr/lib/python2.7/site-packages/samba/provision/__init__.py", line 533, in guess_names
        raise ProvisioningError("guess_names: 'realm =' was not specified in supplied %s.  Please remove the smb.conf file and let provision generate it" % lp.configfile)
    
  14. Pour les trucs que j’ai trouvé sur le Web par rapport à « tree connect failed: NT_STATUS_INTERNAL_ERROR », je pense que est un chose lie à l’authentification

  15. je ne peux pas accéder, par exemple pour le dossier publique:

    smbclient \\\\192.168.1.113\\public -U nobody
    Enter nobody's password: 
    Anonymous login successful
    Domain=[ROUGE] OS=[Unix] Server=[Samba 4.0.1]
    tree connect failed: NT_STATUS_INTERNAL_ERROR
    
  16. Attention au paramètre security, si share je ne peux voir public, tmp …:

    $ smbclient -L 192.168.1.113 -U%
    params.c:OpenConfFile() - Unable to open configuration file "/etc/samba/smb.conf":
            Aucun fichier ou dossier de ce type
    smbclient: Can't load /etc/samba/smb.conf - run testparm to debug it
    Domain=[ROUGE] OS=[Unix] Server=[Samba 4.0.1]
    
            Sharename       Type      Comment
            ---------       ----      -------
            IPC$            IPC       IPC Service
    Domain=[ROUGE] OS=[Unix] Server=[Samba 4.0.1]
    
            Server               Comment
            ---------            -------
    
            Workgroup            Master
            ---------            -------
    

    si security est user:

    $ smbclient -L 192.168.1.113 -U%
    params.c:OpenConfFile() - Unable to open configuration file "/etc/samba/smb.conf":
            Aucun fichier ou dossier de ce type
    smbclient: Can't load /etc/samba/smb.conf - run testparm to debug it
    Domain=[ROUGE] OS=[Unix] Server=[Samba 4.0.1]
    
            Sharename       Type      Comment
            ---------       ----      -------
            homes           Disk      Home Directories
            tmp             Disk      Temporary file space
            public          Disk      
            IPC$            IPC       IPC Service
    Domain=[ROUGE] OS=[Unix] Server=[Samba 4.0.1]
    
            Server               Comment
            ---------            -------
    
            Workgroup            Master
            ---------            -------
    
  17. Je pense que le problème est nmb, j’ai trouvé Mise en place du samba sur commentcamarche.net

  18. Do you want to make it a server with authentication or not?

    If not, make sure you have a line like that in your /etc/samba/smb.conf (depuis ici):

    security = share

  19. Dans mon administrateur des archives je ne peux pas voire le serveur, je pense qui manque quelque chose dans le config file.

  20. Je pense que j’ai résolu le problème avec cette ligne:

    server services = +smb

  21. Mon smbclient output:

    Domain=[ROUGE] OS=[Unix] Server=[Samba 4.0.1]
    
            Sharename       Type      Comment
            ---------       ----      -------
            homes           Disk      Home Directories
            tmp             Disk      Temporary file space
            public          Disk      
            IPC$            IPC       IPC Service
    Domain=[ROUGE] OS=[Unix] Server=[Samba 4.0.1]
    
            Server               Comment
            ---------            -------
    
            Workgroup            Master
            ---------            -------
    
    
  22. Il ne marchais pas:

    # systemctl restart samba
    # # ps aux | grep samba
    root 467 0.0 0.0 6236 960 pts/0 S+ 15:01 0:00 grep samba

    Finalement j’ai réussi à résoudre le problème mais je ne n’ai pas documenté et je ne me rappel bien, pourtant je me souviens que j’ai lu les logs su samba et d’smb et les commentaires sur l’AUR

  23. $ yaourt -S talloc tdb
    $ yaourt -S samba4

    Et voila!!! samba4 sur archlinux :)

  24. Le problème es avec talloc.so et tdb.so qui son dans:
    talloc and samba
    tdb and samba

    Je pense qu’il faut installer ces paquets avant l’installation.

  25. pour l’installation du samba4 (depuis AUR) on va compiler et n’est pas bon idée compiler en tant que root, il faut ajouter un utilisateur:

    # useradd -m -g users -s /bin/bash fredyrouge
    # passwd fredyrouge

    Et je change l’utilisateur:
    # su – fredyrouge

    Finalement en tant que fredyrouge (utilisateur). L’installation du samba4:

    $ yaourt -S samba4
    NOTE: uff il affiche beaucoup d’information et il dis « Unsoported package: Potentially dangerous! » mais il faut essayer:

    J’ai réussi a compiler mais après l’installation:
    Errors occurred, no packages were upgreded
    Warning: Your package are saved in /tmp/yaourt-tmp-fredyruge

  26. J’ai ajouté à /etc/pacman.conf :

    [archlinuxfr]
    Server = http://repo.archlinux.fr/$arch

    L’update:
    pacman -Sy

    Et l’installation du yaourt pour pouvoir utiliser AUR
    pacman -S yaourt

  27. samaba4 n’est pas sur les repositoires (core, extra, community) pourtant il est sur l’AUR

Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s