Hi Everyone,
I need to create a script integrated with Samba that retrieves email addresses from given names, let me explain it better ok ?
I've a Linux Machine into an Active Directory forest, i can get information for current AD usernames, something like:
myserver:~# wbinfo -i andrea
andrea:*:10014:10001:Andrea Benini:/home/DOMAIN/andrea:/bin/bash
I need to retrieve email address for the specified used, possibly using only bash scripts and utilities found in my system (AD integration through Samba+winbindd), is there a way to do it ?
The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.
Answers
the following command (substitute your directory info) can easily pull an email address from AD
ldapsearch -x -h -s sub -b dc=,dc=COM -D "CN=your id,DC=,DC=COM" -W '(&(objectclass=User)(givenName =firstname)(sn=lastname))' mail
wrapping the above in a shell script is trivial. use the command above and leave off 'mail' at the end. it should bring up all attributes that you can see.
I've tried to get some info from AD with PHP and I can, is there a way to get something without installing the whole php-cli and libs ?
Thanks
Ben