Skip to content

Instantly share code, notes, and snippets.

@nfrankel
Created June 5, 2012 09:43
Show Gist options
  • Save nfrankel/2874011 to your computer and use it in GitHub Desktop.
Save nfrankel/2874011 to your computer and use it in GitHub Desktop.
Batch create users in Ubuntu
declare -A students
students[foo]=abricot
students[bar]=brique
students[baz]=botte
for k in "${!students[@]}"
do
adduser "$k"
echo "$k":${students["$k"]} | /usr/sbin/chpasswd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment