Create Bulk User on LDAP
Oleh:
Alfian febriantoro |
10/08/2018 10:52:00 AM
nano userbanyak.sh
#!/bin/bash
for i in {5..99}
do
echo "dn: cn=user$i,ou=VPN,dc=nusantara,dc=cloud" >> user.ldiff
echo "objectClass: inetOrgPerson" >> user.ldiff
echo "objectClass: posixAccount" >> user.ldiff
echo "objectClass: top" >> user.ldiff
echo "sn: user$i" >> user.ldiff
echo "cn: user$i" >> user.ldiff
echo "uid: user$i" >> user.ldiff
echo "uidNumber: $i$i" >> user.ldiff
echo "gidNumber: 10000" >> user.ldiff
echo "homeDirectory: /home/users/user$i" >> user.ldiff
echo "loginShell: /bin/sh" >> user.ldiff
echo "userPasswird:{MD5}" >> user.ldiff
ldapadd -x -D "cn=admin,dc=nusantara,dc=cloud" -w Nusantara2018 -f user.ldiff
done
password digenerate dulu
slappasswd -h {md5} >> userbanyak.sh