Skip to content

Instantly share code, notes, and snippets.

@craigpalermo
Last active August 29, 2015 14:01
Show Gist options
  • Save craigpalermo/e31bcd64b07707ec6494 to your computer and use it in GitHub Desktop.
Save craigpalermo/e31bcd64b07707ec6494 to your computer and use it in GitHub Desktop.
Create an account for each user listed in the external file
#!/bin/sh
# Example:
# sh create_users.sh file_with_usernames.txt
if [ -z "$1"] # check if filename is given
then
echo "No input filename given, exiting."
else
while read NAME; do
echo "Adding user $NAME";
useradd -m "$NAME"; # add user with home folder
done < $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment