Empulse Group a collection of notes from a sys admin, musician, and father

14Aug/12Off

Here is a small bash script that will create a user from a list that you can pipe it complete with setting and printing a random password. This was for mail users so I set the shell to false.

#!/bin/bash

while read USER; do
   PASS=`< /dev/urandom tr -dc A-Za-z0-9_ | head -c8`
   /usr/sbin/useradd -s /bin/false $USER
   echo $PASS | passwd $USER --stdin
   echo "User: $USER / Pass: $PASS"
done;
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.