Skip to content

Instantly share code, notes, and snippets.

@azbones
Created March 7, 2018 18:09
Show Gist options
  • Save azbones/db02862cbfde6ae93bd094ebfc9b60f6 to your computer and use it in GitHub Desktop.
Save azbones/db02862cbfde6ae93bd094ebfc9b60f6 to your computer and use it in GitHub Desktop.
scripts for jupyterhub cis 503
#!/bin/bash
while read user pass;
do
echo "User $user read from file"
egrep "^$user" /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
echo "$user already exists"
else
adduser $user --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
echo "$user:$pass" | sudo chpasswd
echo Username: $user Password: $pass created
fi
done < userlist.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment