I have briefly played around with ,active directories, openldap (novell) , samba , netbios, smb/cifs , kerbros but I am curious what PAM is for?

Is PAM necessary for any of the above to work?

I thought the above applications like openldap , samba ,...etc use their own database for users , groups or security permissions. Or do they need PAM.

What is the benefit of using PAM if any and when would you use it over something else?

sorry for the repetition I am a little lost