# LDAP bind error

**URL:** <https://rubytalk.org/t/ldap-bind-error/41231>\
**Category:** ruby-talk\
**Created:** [8 October 2007 04:37 UTC](https://rubytalk.org/t/ldap-bind-error/41231 "2007-10-08T04:37:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pokkai\_Dokkai](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@Pokkai\_Dokkai](https://rubytalk.org/u/Pokkai_Dokkai)\
**Post date:** [8 October 2007 04:37 UTC](https://rubytalk.org/t/ldap-bind-error/41231/1 "2007-10-08T04:37:47Z")

</div>

i am new to ruby .....  
in java my ldap server is connecting like

> **···**
>
> --------------------------------------------  
> username="myname"  
> password="\*\*\*\*\*\*\*\*\*"  
> LDAPConnection ld = new LDAPConnection();  
> ld.connect( "192.168.1.1", 389);  
> con=ld.authenticate  
> ("uid="+username+",ou=People,dc=mydomain,dc=com",password);  
> /// con---\>true
> 
> but in ruby  
> -----------------------------------  
> ldap\_con = Net::LDAP.new({:host =\> '192.168.1.1', :port =\> 389,  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:auth=\>{ :method=\>:simple,:username =\>  
> username,  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:password =\> password  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@con=ldap\_con.bind
> 
> #@con ---\>false (always )  
> -------------------------------------------------------  
> what is wrong here  
> any help please.....  
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Francis\_Cianfrocca](https://avatars.discourse-cdn.com/v4/letter/f/7bcc69/32.png) [@Francis\_Cianfrocca](https://rubytalk.org/u/Francis_Cianfrocca)\
**Post date:** [8 October 2007 07:21 UTC](https://rubytalk.org/t/ldap-bind-error/41231/2 "2007-10-08T07:21:21Z")

</div>

Try giving the whole DN as the user name.

> **···**
>
> On 10/8/07, Pokkai Dokkai \<bad\_good\_lion@yahoo.com\> wrote:
> 
> > i am new to ruby .....  
> > in java my ldap server is connecting like  
> > --------------------------------------------  
> > username="myname"  
> > password="\*\*\*\*\*\*\*\*\*"  
> > LDAPConnection ld = new LDAPConnection();  
> > ld.connect( "192.168.1.1", 389);  
> > con=ld.authenticate  
> > ("uid="+username+",ou=People,dc=mydomain,dc=com",password);  
> > /// con---\>true
> > 
> > but in ruby  
> > -----------------------------------  
> > ldap\_con = Net::LDAP.new({:host =\> '192.168.1.1', :port =\> 389,  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:auth=\>{ :method=\>:simple,:username =\>  
> > username,  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:password =\> password  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;})  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@con=ldap\_con.bind
> > 
> > #@con ---\>false (always )  
> > -------------------------------------------------------  
> > what is wrong here  
> > any help please.....  
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Pokkai\_Dokkai](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@Pokkai\_Dokkai](https://rubytalk.org/u/Pokkai_Dokkai)\
**Post date:** [8 October 2007 08:12 UTC](https://rubytalk.org/t/ldap-bind-error/41231/3 "2007-10-08T08:12:16Z")

</div>

Francis Cianfrocca wrote:

> Try giving the whole DN as the user name.

sorry i did't get you....  
can you show a sample (how to give the whole DN as the user name )

thank you

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Francis\_Cianfrocca](https://avatars.discourse-cdn.com/v4/letter/f/7bcc69/32.png) [@Francis\_Cianfrocca](https://rubytalk.org/u/Francis_Cianfrocca)\
**Post date:** [8 October 2007 11:37 UTC](https://rubytalk.org/t/ldap-bind-error/41231/4 "2007-10-08T11:37:43Z")

</div>

It's in your own example:

uid=username,ou=People,dc=mydomain,dc=com

> **···**
>
> On 10/8/07, Pokkai Dokkai \<bad\_good\_lion@yahoo.com\> wrote:
> 
> > Francis Cianfrocca wrote:  
> > \> Try giving the whole DN as the user name.
> > 
> > sorry i did't get you....  
> > can you show a sample (how to give the whole DN as the user name )

---

<div class="post-metadata">

**Author:** ![Pokkai\_Dokkai](https://avatars.discourse-cdn.com/v4/letter/p/7feea3/32.png) [@Pokkai\_Dokkai](https://rubytalk.org/u/Pokkai_Dokkai)\
**Post date:** [8 October 2007 12:26 UTC](https://rubytalk.org/t/ldap-bind-error/41231/5 "2007-10-08T12:26:04Z")

</div>

Francis Cianfrocca wrote:

> uid=username,ou=People,dc=mydomain,dc=com

not fine  
same error....

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
