有人用python写过ldap的登录和修改密码吗

Python026

有人用python写过ldap的登录和修改密码吗,第1张

你说的是AD域账号吧?先安装lpda3的库

在cmd命令行下运行:

pin install ldap3

然后开始写python脚本

from ldap3 import *

user = "CN=visitor02 ,OU=level1,DC=hello,DC=com,DC=cn" # 定义你要给谁改密码

admin='xxxxxx' #xxxx换成你域控的管理员账号如hello\administrator, hello是域名

adminpwd = 'xxxx' # 域控的管理员密码

s = Server('10.10.xx.xx', get_info=ALL, use_ssl=True) #10.10.xx.xx换成你域控的IP地址,这条是定义域服务器信息

c = Connection(s,user=admin, password=adminpwd, auto_bind=True) #登录域服务器

print(c.extend.microsoft.modify_password(user,"123456")) #这行就是改密码。如果print出true,就是成功了。如果false,再在下面加一条

print(c.response) #会显示为什么失败。

如果想了解更多的python ldap3库,可以看这个链接网页链接

initiaise the config file. (Only applied if the first time to run jupyter)jupyter notebook --generate-config;2、on remote serverjupyter notebook password这时生成的密码会在/.jupyter/jupyter_notebook_config.json里面,这样密码就重设成功了

远程服务器是指远程访问服务器,就是把在互联网中的计算机和在局域网中的远程访问服务器相连接。

远程访问服务允许客户机通过拨号连接或虚拟专用连接登录网络

1.normal_user是存放用户id及密码的文件

2.lock_file是存放被锁定的用户id的文档,默认为空.

3.程序会对normal_user里的合法用户id进行判断,若连续输入用户id错误达三次程序直接退出.

4.程序会输入对正确用户名后的密码进行判断,输入密码有3次机会,连续三次错误则会锁定用户id并且退出.