Created
March 4, 2018 21:41
-
-
Save m4ldonado/38a66751de7569ca46c32febb4f4f699 to your computer and use it in GitHub Desktop.
create an ldap user with python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from ldap3 import Server, Connection, ALL | |
ldap_url = '' | |
admin_dn = '' | |
admin_pass = '' | |
new_user_dn = '' | |
server = Server(ldap_url, use_ssl=True, port=636, get_info=ALL) | |
conn = Connection(server, admin_dn, admin_pass) | |
conn.bind () | |
print(conn) | |
conn.add('new_user_dn', ['inetOrgPerson', 'posixAccount'] , {'cn': '', 'gidNumber': '', 'homeDirectory': '', 'sn': '', 'uid' : '', 'uidNumber': '', 'mail': ''}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment