UNIX Script to query Active Directory: give cn (NT login name) and receive mail (Email address)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX Script to query Active Directory: give cn (NT login name) and receive mail (Email address)
# 1  
Old 05-18-2010
UNIX Script to query Active Directory: give cn (NT login name) and receive mail (Email address)

Hi folks

I need to write UNIX script (with ldapsearch) to query Active Directory. Input is NT login name and output is Email address.

Attached a screenshot of Sysinternals "AD Explorer". I need to do the same in CLI.

Image

I am absolute LDAP/ldapsearch noob.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Further to my query re: failed attempt to change email address on existing account

Neo Thanks for your reply to my original post, entitled "Problem changing the email address associated with my unix.com account". I am unable to reply to you in that thread, as I am unable to log-on to unix.com! From what you said about purging dormant accounts, it is likely that my account... (1 Reply)
Discussion started by: irb
1 Replies

2. Proxy Server

Solaris 11.1 login authenticate with windows active directory

Hi, is that possible to login to solaris 11.1 authenticate with windows active directory? the user id is created in the windows active directory. Environment: Solaris 11.1 Windows 2012 Active Directory (3 Replies)
Discussion started by: freshmeat
3 Replies

3. Shell Programming and Scripting

Run a script when I receive an email

Hi expert I wish to start a shell script when I receive an email. I modified the aliases file and I add this string as400nag: "|/home/nag-script/startstop/AS400-Boot.sh The solution works . When the as400nag user receive an email the /home/nag-script/startstop/AS400-Boot.sh starts .but... (3 Replies)
Discussion started by: emi65
3 Replies

4. Red Hat

How to change sender email address in mail -s command

Just having trouble trying to figure out what the option is. When I do mail -s "Subject" someuser@example.com I can't seem to specify "from" or "sender" option as I need it for my task. I tried using --f or -f though it didn't work. Can someone please tell me what other option... (0 Replies)
Discussion started by: rockf1bull
0 Replies

5. Shell Programming and Scripting

keep mail command active inside a script on unix

well, I have a script with this code inside: nohup /usr/sbin/auditstream | /usr/sbin/auditselect -m -e "event== USER_Create || event== USER_Remove || event== USER_Change || event== GROUP_Create || event== GROUP_Remove || event== GROUP_Change || event== PASSWORD_Change " | /usr/sbin/auditpr -h... (4 Replies)
Discussion started by: iga3725
4 Replies

6. Shell Programming and Scripting

I could not receive the mail sent from the unix server using 'mailx'

Hi All, I have sent a mail to my gmail id using the below command. echo " " | mailx -s "sub" myid@gmail.com I didn't get any error notification. But still I didn't receive that mail still.. please help me to learn how to send mail to other provider (Yahoo/gmail) from unix server.... (1 Reply)
Discussion started by: little_wonder
1 Replies

7. UNIX for Dummies Questions & Answers

I can send but cannot receive mail with unix?

Hi all, First post! I have just discovered that I can use unix to send mail to a mail address. I normally use entourage for my mail. This unix mail is very intriguing to me, but something is not working... I tried the search, but could not find the answer... This works: (in terminal)... (1 Reply)
Discussion started by: bjorn
1 Replies

8. Shell Programming and Scripting

how to know if the mailx command really sends the mail to the email address?

Hi guys, I have a question about the returning message of the mailx command. if I run a mailx command, how can I know if the email has been sent to the email address? If the email address doesn't exist, is there any error message returned? If yes, how can I get the error message? Thanks... (3 Replies)
Discussion started by: sheenshine
3 Replies

9. UNIX for Dummies Questions & Answers

Receive e-mail on unix box

Hi, I am not sure if it is a good question or not. Is there a unix utility which can be configured with exchange server and then receive e-mails? Thanks! (4 Replies)
Discussion started by: DejaVu
4 Replies
Login or Register to Ask a Question
CHPASS(1)						    BSD General Commands Manual 						 CHPASS(1)

NAME
chpass, chfn, chsh -- add or change user database information SYNOPSIS
chpass [-l location] [-u authname] [-s newshell] [user] DESCRIPTION
The chpass utility allows editing of the user database information associated with user or, by default, the current user. The chpass utility cannot change the user's password on Open Directory systems. Use the passwd(1) utility instead. The chfn, and chsh utilities behave identically to chpass. (There is only one program.) The information is formatted and supplied to an editor for changes. Only the information that the user is allowed to change is displayed. The options are as follows: -l location If not specified, chpass will perform a search for the user record on all available Open Directory nodes. When specified, chpass will edit the user record on the directory node at the given location. -u authname The user name to use when authenticating to the directory node containing the user. -s newshell Attempt to change the user's shell to newshell. Possible display items are as follows: Login: user's login name Uid: user's login Gid: user's login group Generated uid: user's UUID Full Name: user's real name Office Location: user's office location Office Phone: user's office phone Home Phone: user's home phone Home Directory: user's home directory Shell: user's login shell The login field is the user name used to access the computer account. The uid field is the number associated with the login field. Both of these fields should be unique across the system (and often across a group of systems) as they control file access. While it is possible to have multiple entries with identical login names and/or identical user id's, it is usually a mistake to do so. Rou- tines that manipulate these files will often return only one of the multiple entries, and that one by random selection. The group field is the group that the user will be placed in at login. Since BSD supports multiple groups (see groups(1)) this field cur- rently has little special meaning. This field may be filled in with either a number or a group name (see group(5)). The generated uid field is the globally unique identifier (UUID) for the user. The full name field contains the full name of the user. The user's home directory is the full UNIX path name where the user will be placed at login. The shell field is the command interpreter the user prefers. If the shell field is empty, the Bourne shell, /bin/sh, is assumed. When altering a login shell, and not the super-user, the user may not change from a non-standard shell or to a non-standard shell. Non-standard is defined as a shell not found in /etc/shells. The picture field is the path to a picture to be displayed for the user. OPEN DIRECTORY
User database entries are under the control of DirectoryService(8) and may be physically located in many different places, including the local Directory Service node, and remote LDAP servers. This version of chpass uses Open Directory to change user database information. It does not interact with the historic flat file database /etc/master.passwd ENVIRONMENT
The vi(1) editor will be used unless the environment variable EDITOR is set to an alternate editor. When the editor terminates, the informa- tion is re-read and used to update the user database itself. Only the user, or the super-user, may edit the information associated with the user. FILES
/etc/chpass.XXXXXX temporary copy of the data to edit /etc/shells the list of approved shells SEE ALSO
login(1), passwd(1), getusershell(3), passwd(5) Robert Morris and Ken Thompson, UNIX Password security. HISTORY
The chpass utility appeared in 4.3BSD-Reno. BSD
December 30, 1993 BSD