Skip to content

Instantly share code, notes, and snippets.

@hiddendragonXVII
Created September 3, 2010 04:13
Show Gist options
  • Save hiddendragonXVII/563404 to your computer and use it in GitHub Desktop.
Save hiddendragonXVII/563404 to your computer and use it in GitHub Desktop.
#!/bin/env bash
# Author Paul Wand 2010
#
# This script creates users based text file containing usernames
#
# requires apg (automatic password generator):
# sudo yum install apg
# nab list of users from gist.github
users=`curl http://gist.github.com/raw/563371/6db567224f54db7e061c75789e3dec5dc740f53f/eosuserroster`
echo "move your mouse around to increase speed"
for user in $users
do
# -m creates the home directory
adduser -m $user
# setting the password can take a long time
# to speed this process up, move the mouse around
# this works because apg uses /dev/random to generate the passwords
password=`apg -n 1`
#save the auto generated password
echo $user:$password >>passwords
#set the password to the user
echo $password|passwd $user --stdin
chage $user -d 0
done
if [ `cat passwords|wc -l` = 23 ]; then
echo "Complete! resulting username passwords are stored in the passwords file"
echo "your password is different now too, you should probably change it!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment