[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Produce 300 users with random passwords



What about mkpasswd (from expect-5.38.0-74.i386.rpm) ?

It allows you to control length, number of digits, number of lowercase/uppercase/special characters. You can either generate these and merge into a file (copy/paste or merge or whatever) or it can also set that password too.



Below is a few examples...

Let's say you have a csv file as such (like the one you have with all the same password):

username1, Real Name1, passwd
username2, Real Name2, passwd

cat data.txt | while IFS=',' read USER FULL PASSWORD; do echo $USER, $FULL, `mkpasswd`; done
username1, Real Name1, ^0jxnyTP4
username2, Real Name2, 90yoUtzI(


Or with options such as:
cat data.txt | while IFS=',' read USER FULL PASSWORD; do echo $USER, $FULL, `mkpasswd -l 10 -d 2 -c
3 -C 2 -s 3`; done
username1, Real Name1, y<8E]#Fce4
username2, Real Name2, e7F"7pc'|Q


And to send this to a new csv file, just use the > or >> after "done":
cat data.txt | while IFS=',' read USER FULL PASSWORD; do echo $USER, $FULL, `mkpasswd`; done > newcvs.txt


You can also generate your 300 sheets of paper as follows:
simple:
cat newcvs.txt | while read REPLY; do echo $REPLY | enscript --margins=20:20:20:20; done



or complex (almost mail merge):
cat newcvs.txt | while IFS=',' read USER FULL PASSWORD; do echo Dear $FULL, your username is $USER and your password is $PASSWORD | enscript --margins=20:20:20:20; done


or full blown mail merge:
cat newcvs.txt | while IFS=',' read USER FULL PASSWORD; do cat formletter.txt | sed -e "s/PLACE_FULL_HERE/$FULL/g" -e "s/PLACE_USER_HERE/$USER/g" -e "s/PLACE_PASSWORD_HERE/$PASSWORD/g" | enscript --margins=20:20:20:20; done


cat formletter.txt
Dear PLACE_FULL_HERE,
Your userid is PLACE_USER_HERE
and your password is PLACE_PASSWORD_HERE

--RB


Trond Mæhlum wrote:


I use a Danish program called nybruger (Danish for new user) to produce my users. I make a csv file with three columns. Username, real name, password. This list is saved as .csv. The program then calls adduser for all the entries in that list and makes my users - complete with homedirs and all.

I did this the easy way, by making one password for all users, which had to be changed at first logon. I now see that this was not a good idea... What I now want to do is to have a program making 300 passwords at random. I then need to paste that list into the passwords column in the spreadsheet.

Then when the users are created, I need to print out 300 sheets which says: Your username is [user1] and your password is [password1]. Where user and passwords come from that csv list.

Is this doable and if so, how do I do it? If there is an alternative approach I am open for suggestions....

Regards

Trond Mæhlum






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]