Skip to content

Instantly share code, notes, and snippets.

@metrofx
Last active August 29, 2015 14:00
Show Gist options
  • Save metrofx/11362004 to your computer and use it in GitHub Desktop.
Save metrofx/11362004 to your computer and use it in GitHub Desktop.
Bulk-create linux users with auto-generated password.
#!/bin/bash
for userlist in `cat userlist.txt`
do
user=`echo $userlist | cut -f 1 -d ,`
pwd=`echo $userlist | cut -f 2 -d ,`
echo "useradd -m -s /bin/bash $user && echo $user:$pwd | chpasswd"
done
#!/bin/bash
count=1
while [ $count -le 12 ]
do
password=`date|md5sum|head -c 8`
echo "guestuser$count,$password"
((count++))
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment