Dear All, I am a new bie in perl. I have to generate LDIF files after reading a file containing a list of userids of a new admitted batch of a university along with their passwords, uidNUmber And gidNumber. Say the new batch contains 400 students, and the uidNumber starts from the number 2631 onwards. So for each new userid read from the file (it contains the userids and their respective MD5 password), a new LDIF file has to be generated. The LDIF file format for a student is :-
dn: uid=s08-1-5-097,ou=student,dc=nits,dc=ac,dc=in uid: s08-1-5-097 cn: s08-1-5-097 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$1$2P6e6UmE$ZewMWmNBQ0ghQ9l/OK0Ft/ loginShell: /bin/bash uidNumber: 2631 gidNumber: 2631 homeDirectory: /mnt/btech/s08-1-5-097 shadowLastChange:13458 shadowMin: 0 shadowMax: 999999 shadowWarning: 7 1) Here the lines which should be updated are the first line, where the uid=uid=s08-1-5-097, is to be filled up for every new uid read from the input file. 2) The second line is to be updated with the uid read from the input file. 3) The third line is to be updated with the uid for value of cn: 4) Lines 4-7 are not to be changed for anything. They would remain same as shown above. 5) The line 8's userPassword has to be updated after the MD5 passoword corresponding to each uid. 6) Line 6 would remain same for all the files. Nothing to be changed. 7) uidNumber and gidNumber would be same for a stundent and should be incremented for the nest file. 8) The home directory should be as: /mnt/btech/value of uid where the uid's value is read from the input file, for example it is here->s08-1-5-097 for all the files it would be different as uid is different for each student. This would be their home directory. 9) The lines below the line of homedirectory would remain same for all the files. Please provide me the perl script for that. I am just a new bie and would take weeks to write the script for doing that. A sample student file of five students is as given below (in the format of uid, MD5 password) as below:- s08-1-5-093 $1$2P6e6UmE$X71iU1QF6it6oxalIPqMS/ s08-1-5-094 $1$2P6e6UmE$R37ySEfe5JPjRTmdIo2xf. s08-1-5-095 $1$2P6e6UmE$VKlXe6lSoXr4aWBmuSn6u/ s08-1-5-096 $1$2P6e6UmE$H7Q3Thg4KQKeuAvOsffp8. s08-1-5-097 $1$2P6e6UmE$ZewMWmNBQ0ghQ9l/OK0Ft/ Now please generate five LDIF files in the format as shown above for each uid after reading fro the input file of five students :- Thanks, Jmaan