How can I change password for domain user(windows Active Directory) using Python?

后端 未结 3 350
挽巷
挽巷 2020-12-21 00:38

How can I change the password for a domain user with Python? I have the ldap modules on board but have no solution. I managed to query the current settings via ldap, but how

3条回答
  •  Happy的楠姐
    2020-12-21 01:01

    The password change code looks perfect.

    you are not binding after initialize. bind is a must.

    con.simple_bind_s(user, pass)
    

    Also, for starters you can ignore certificate errors for bind by setting this option. Once you are able to update password, you can harden the certificate thingy if you want.

    con.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
    

提交回复
热议问题