12.7. Connecting to a Remote OpenLDAP Server
Problem
You're not always going to be sitting at your physical server, or you want to run it headless, so you need to know how to administer your OpenLDAP server remotely.
Solution
All of the OpenLDAP commands use the same -H option to connect to a remote host, like
this example for a local network that uses the server's
hostname:
# ldapsearch -H ldap://xena -xtb 'dc=alrac,dc=net'Or, you may use the fully qualified domain name:
# ldapsearch -H ldap://xena.alrac.net -xtb 'dc=alrac,dc=net'Or, specify the port. You don't need to do this unless you're using an alternate port:
# ldapsearch -H ldap://xena.alrac.net:389 -xtb 'dc=alrac,dc=net'Discussion
A lot of documentation still refers to using the lowercase
-h, but this has been deprecated,
and someday will go away for good.
You don't have to use just the options in the example commands; any OpenLDAP command can be run remotely (e.g., searches, making changes, etc.).
See Also
man 1 ldapsearchman 1 ldapmodifyOpenLDAP.org: http://www.openldap.org/
LDAP Directories Explained: An Introduction and Analysis, by Brian Arkills (Addison-Wesley)
LDAP System Administration, by Gerald Carter (O'Reilly)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access