A problem with Expect script LDAP password input
by artadam from LinuxQuestions.org on (#5Q5ZE)
I have a problem with password input in ldapsearch command. I have script witch asks for LDAP password twice I have something like this except (expect_ldap.sh) script to enter LDAP password:
Code:#!/usr/bin/expect -d
set timeout -1
spawn sudo ./ldapu.sh
expect "Enter LDAP Password:"
sleep 1
send "password\r"
expect "Enter LDAP Password:"
sleep 1
send "password\r"
expect eofAnd it does not works with LDAP here is an output:
Code:ldap_bind: Invalid credentials (49)
additional info: 80090308: LdapErr: DSID-0C090400, comment: AcceptSecurityContext error, data 52e, v1db1But when I run my ldapu.sh script and manually insert twice LDAP passwords all works fine.
Can anyone see the problem?
May be exists more correct way to solve this problem?
Thanks for your answers! :)
Code:#!/usr/bin/expect -d
set timeout -1
spawn sudo ./ldapu.sh
expect "Enter LDAP Password:"
sleep 1
send "password\r"
expect "Enter LDAP Password:"
sleep 1
send "password\r"
expect eofAnd it does not works with LDAP here is an output:
Code:ldap_bind: Invalid credentials (49)
additional info: 80090308: LdapErr: DSID-0C090400, comment: AcceptSecurityContext error, data 52e, v1db1But when I run my ldapu.sh script and manually insert twice LDAP passwords all works fine.
Can anyone see the problem?
May be exists more correct way to solve this problem?
Thanks for your answers! :)