LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-28-2022, 01:02 PM   #1
danmartinj
Member
 
Registered: Oct 2009
Posts: 117

Rep: Reputation: 1
Query LDAP Domain To Find Status On User Accounts Using Linux


Hello,

Been looking at some linux commands like ldapsearch to query status on domain user accounts. I am pretty sure ldapsearch supports this but I am also pretty sure you have to supply it a domain controller to query. With windows you do not have to do this:

Code:
net user USER /domain
I am just trying to figure out the most simplest and stable command to use on Linux. Does anyone have any suggestions?

Thanks,
Joe
 
Old 03-01-2022, 10:01 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,675

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by danmartinj View Post
Hello,
Been looking at some linux commands like ldapsearch to query status on domain user accounts. I am pretty sure ldapsearch supports this but I am also pretty sure you have to supply it a domain controller to query. With windows you do not have to do this:
Code:
net user USER /domain
I am just trying to figure out the most simplest and stable command to use on Linux. Does anyone have any suggestions?
You say you don't have to specify a domain controller in Windows...yet you're specifying a domain in the command-line you're using. Which (by default) will resolve back in Windows to the domain controller you're attached to. Meaning in essence, you ARE providing one.

The ldapsearch man pages have the switches you need, and there are many examples you can find. With TLS:
Code:
ldapsearch -H ldaps://domain.controller.com -x -W -D "user@name.com" -b "dc=controller,dc=com" "(sAMAccountName=someuser)"
And without:
Code:
ldapsearch -H ldap://domain.controller.com -x -W -D "user@name.com" -b "dc=controller,dc=com" "(sAMAccountName=someuser)"
 
1 members found this post helpful.
Old 03-01-2022, 12:26 PM   #3
danmartinj
Member
 
Registered: Oct 2009
Posts: 117

Original Poster
Rep: Reputation: 1
Hey TBOne,

I will be happy to mark this as solved as your suggestion did work for us. However, it looks like the -W flag is asking for a password to bind to. We are hoping to create a script and use cron to have it automatically run. Is there a way to get this to work without asking for a password or is there a work around? Using a password seems insecure and can be hard to work with using a script. Any suggestions would be greatly appreciated and I will mark his as solved by you. Thanks so much for your help.

Thanks,
Joe
 
Old 03-01-2022, 10:10 PM   #4
danmartinj
Member
 
Registered: Oct 2009
Posts: 117

Original Poster
Rep: Reputation: 1
Just as a fallow I did get that to work by using the anonymous query so we do not have to setup a password within the script. thanks. this is complete now.

Joe
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ubuntu ldap clients cannot login after ldap password is changed from the ldap server nitinm Ubuntu 8 08-20-2020 07:32 AM
OpenLDAP - Difference between etc/ldap.conf and etc/ldap/ldap.conf ramkrishnan Linux - Server 1 07-09-2018 02:01 PM
Samba4 domain not seeing imported users ,Groups and Machine Accounts from samba3 domain treedstang Linux - Server 0 01-06-2013 11:45 PM
Difference between /etc/ldap.conf vs. /etc/ldap/ldap.conf fahadaziz Linux - Server 8 07-14-2010 05:12 AM
Merging Linux local accounts with LDAP accounts Nortekman Linux - Server 1 05-03-2009 11:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration