Posted by: Anonymous
[ip: 206.248.137.79]
on September 26, 2007 01:14 PM
Using a spreadsheet is fine, but don't generate passwords in the spreadsheet. This is a "smoking gun", and the "random" number generator in your spreadsheet is not very random.
Instead, you can use the "mkpasswd" command. And it combines nicely with the --stdin option on the passwd command. Here is the bits of the script I use to do it:
Automated user management with Expect
Posted by: Anonymous [ip: 206.248.137.79] on September 26, 2007 01:14 PMInstead, you can use the "mkpasswd" command. And it combines nicely with the --stdin option on the passwd command. Here is the bits of the script I use to do it:
#!/bin/sh
USERID=$1
PASSWORD=`mkpasswd -s 0`
echo "$PASSWORD" | /usr/bin/passwd --stdin $USERID
/usr/sbin/sendmail -oi -t <<EOF
To: $USERID <$USERID@domain.com>
From: System Adminstrator <root@domain.com>
Subject: Your new password
An account has been created for you:
Username: $USERID
Password: $PASSWORD
EOF
#