You would benefit greatly by reading these samba wiki pages: https://wiki.samba.org/index.php/Setup_a_Samba_Active_Directory_Domain_Controller https://wiki.samba.org/index.php/Setup_Samba_as_an_AD_Domain_Member https://wiki.samba.org/index.php/Libnss_winbind_links