diff --git a/src/include/nsdb.h b/src/include/nsdb.h
index 2895433..81b1bd6 100644
--- a/src/include/nsdb.h
+++ b/src/include/nsdb.h
@@ -391,6 +391,11 @@ FedFsStatus	 nsdb_ping_s(const char *hostname, const unsigned short port,
 				unsigned int *ldap_err);
 
 /**
+ * Enable LDAP debugging when contacting an NSDB
+ */
+void		 nsdb_enable_ldap_debugging(void);
+
+/**
  ** Readability helpers
  **/
 const char	*nsdb_display_fedfsconnectionsec(const FedFsConnectionSec sectype);
diff --git a/src/libnsdb/ldap.c b/src/libnsdb/ldap.c
index cec593e..7f001a0 100644
--- a/src/libnsdb/ldap.c
+++ b/src/libnsdb/ldap.c
@@ -129,6 +129,28 @@ __nsdb_modify_nsdb_s(const char *func, LDAP *ld, const char *dn, LDAPMod *mod,
 	__nsdb_modify_nsdb_s(__func__, ld, dn, mod, ldaperr)
 
 /**
+ * Enable LDAP debugging when contacting an NSDB
+ *
+ */
+void
+nsdb_enable_ldap_debugging(void)
+{
+	int rc, debug;
+
+	debug = 0xffff;		/* LDAP_DEBUG_ANY */
+
+#if 0
+	rc = ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &debug);
+	if (rc != LBER_OPT_SUCCESS)
+		xlog(L_ERROR, "Failed to set LBER_OPT_DEBUG_LEVEL");
+#endif
+
+	rc = ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &debug);
+	if (rc != LDAP_OPT_SUCCESS )
+		xlog(L_ERROR, "Failed to set LDAP_OPT_DEBUG_LEVEL");
+}
+
+/**
  * Read a password from stdin, disabling character echo
  *
  * @return a NUL-terminated C string containing the typed-in password.  Caller must free the string with free(3)
diff --git a/src/nsdbc/nsdb-annotate.c b/src/nsdbc/nsdb-annotate.c
index c4ad5f4..ed9cbe1 100644
--- a/src/nsdbc/nsdb-annotate.c
+++ b/src/nsdbc/nsdb-annotate.c
@@ -147,6 +147,7 @@ main(int argc, char **argv)
 			break;
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-create-fsl.c b/src/nsdbc/nsdb-create-fsl.c
index 845d452..432d7b4 100644
--- a/src/nsdbc/nsdb-create-fsl.c
+++ b/src/nsdbc/nsdb-create-fsl.c
@@ -141,6 +141,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-create-fsn.c b/src/nsdbc/nsdb-create-fsn.c
index fd53120..b0b31e8 100644
--- a/src/nsdbc/nsdb-create-fsn.c
+++ b/src/nsdbc/nsdb-create-fsn.c
@@ -145,6 +145,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-delete-fsl.c b/src/nsdbc/nsdb-delete-fsl.c
index 726845f..30f3e87 100644
--- a/src/nsdbc/nsdb-delete-fsl.c
+++ b/src/nsdbc/nsdb-delete-fsl.c
@@ -140,6 +140,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-delete-fsn.c b/src/nsdbc/nsdb-delete-fsn.c
index f3927f0..5355a92 100644
--- a/src/nsdbc/nsdb-delete-fsn.c
+++ b/src/nsdbc/nsdb-delete-fsn.c
@@ -139,6 +139,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-delete-nsdb.c b/src/nsdbc/nsdb-delete-nsdb.c
index f76d786..2777b51 100644
--- a/src/nsdbc/nsdb-delete-nsdb.c
+++ b/src/nsdbc/nsdb-delete-nsdb.c
@@ -129,6 +129,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-describe.c b/src/nsdbc/nsdb-describe.c
index 947cab1..944380a 100644
--- a/src/nsdbc/nsdb-describe.c
+++ b/src/nsdbc/nsdb-describe.c
@@ -142,6 +142,7 @@ main(int argc, char **argv)
 			break;
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-list.c b/src/nsdbc/nsdb-list.c
index e3a8ab0..e02761c 100644
--- a/src/nsdbc/nsdb-list.c
+++ b/src/nsdbc/nsdb-list.c
@@ -233,6 +233,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'e':
 			nce = optarg;
diff --git a/src/nsdbc/nsdb-nces.c b/src/nsdbc/nsdb-nces.c
index 247ccf6..0c32159 100644
--- a/src/nsdbc/nsdb-nces.c
+++ b/src/nsdbc/nsdb-nces.c
@@ -129,6 +129,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'l':
 			nsdbname = optarg;
diff --git a/src/nsdbc/nsdb-remove-nci.c b/src/nsdbc/nsdb-remove-nci.c
index 4de2b10..0d852d4 100644
--- a/src/nsdbc/nsdb-remove-nci.c
+++ b/src/nsdbc/nsdb-remove-nci.c
@@ -131,6 +131,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-resolve-fsn.c b/src/nsdbc/nsdb-resolve-fsn.c
index 23d292d..9b93df7 100644
--- a/src/nsdbc/nsdb-resolve-fsn.c
+++ b/src/nsdbc/nsdb-resolve-fsn.c
@@ -283,6 +283,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'e':
 			nce = optarg;
diff --git a/src/nsdbc/nsdb-simple-nce.c b/src/nsdbc/nsdb-simple-nce.c
index d6530cf..dca1cdf 100644
--- a/src/nsdbc/nsdb-simple-nce.c
+++ b/src/nsdbc/nsdb-simple-nce.c
@@ -129,6 +129,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-update-fsl.c b/src/nsdbc/nsdb-update-fsl.c
index cfd7e13..80c4047 100644
--- a/src/nsdbc/nsdb-update-fsl.c
+++ b/src/nsdbc/nsdb-update-fsl.c
@@ -143,6 +143,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
diff --git a/src/nsdbc/nsdb-update-nci.c b/src/nsdbc/nsdb-update-nci.c
index cb057af..757b080 100644
--- a/src/nsdbc/nsdb-update-nci.c
+++ b/src/nsdbc/nsdb-update-nci.c
@@ -136,6 +136,7 @@ main(int argc, char **argv)
 		switch (arg) {
 		case 'd':
 			xlog_config(D_ALL, 1);
+			nsdb_enable_ldap_debugging();
 			break;
 		case 'D':
 			binddn = optarg;
