问题描述
基本上尝试使用 LDAP python 重置用户的密码.我在这里浏览了各种帖子,但没有运气:(.
Basically trying to reset the user's password using LDAP python. I've gone through various posts here but no luck :(.
尝试使用:
a) modify_s() - 每次都返回没有这样的对象".尝试使用不同的用户 DN.
a) modify_s() - returns "No such object" every time. Tried with different user DN.
{'info': "0000208D: NameErr: DSID-0310020A, issue 2001 (NO_OBJECT), data 0, best match of: 'DC=mydomain,DC=com' ", 'matched': 'DC=mydomain,DC=com', 'desc': '没有这样的对象'}
{'info': "0000208D: NameErr: DSID-0310020A, problem 2001 (NO_OBJECT), data 0, best match of: 'DC=mydomain,DC=com' ", 'matched': 'DC=mydomain,DC=com', 'desc': 'No such object'}
这里是代码片段:
b) passwd(userEmail, oldPassword, newPassword)
.它执行得很好,但密码没有更新.
b) passwd(userEmail, oldPassword, newPassword)
. It gets executed well but password is not updated.
在确定问题时需要帮助.
Need help in identifying the problem.
参考链接:Python+LDAP+SSL
python-ldap 和 Microsoft Active Directory:连接并删除用户
如何设置lockoutTime和Active Directory 用户的密码
如何更改密码对于使用 Python 的域用户(Windows Active Directory)?
https://groups.google.com/forum/#!topic/macromedia.coldfusion.security/Rq7xx15OeBs
http://www.grotan.com/ldap/python-ldap-samples.html#add
http://marcitland.blogspot.in/2011/02/python-active-directory-linux.html
https://snipt.net/Fotinakis/change-active-directory-password-via-ldap-modify-call/
推荐答案
我遇到了同样的问题,并决定询问Server Fault.我得到的答案帮助我弄清楚我的代码出了什么问题.总而言之,更新 AD 密码有两种不同的方法:一种是普通用户更新自己的密码,另一种是管理员(或任何具有足够访问权限的帐户)为其他用户重置密码.
I had the very same issue and decided to ask on Server Fault. The answer I got helped me to figure out what was wrong in my code. To summarize, there is 2 diifferent methods to update an AD password: 1 for regular user updating his own password, and another 1 for administrator (or any account with sufficient access rights) resetting the password for another user.
方法一:用户自己更新密码
方法二:管理员账号更新普通用户密码
请注意,第二种方法需要绑定不同的账户(有足够的权限),但允许设置新密码而无需重新输入旧密码.
Please note that the second method needs to Bind with a different account (with sufficient rights) but allows to set the new password without re-typing the old one.
这篇关于使用 ldap python 更新 Active Directory 密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!