Skip to content

Instantly share code, notes, and snippets.

@Creased
Created June 16, 2020 12:01
Show Gist options
  • Save Creased/9995d728e6590aeeef1333a3b2dd4765 to your computer and use it in GitHub Desktop.
Save Creased/9995d728e6590aeeef1333a3b2dd4765 to your computer and use it in GitHub Desktop.
Bulk user creation (with sudo)
#!/bin/bash
while IFS=';' read -r USER PASSWORD; do
echo "Creating ${USER} user..."
useradd -s /bin/bash -d /home/${USER} -m ${USER}
usermod -aG sudo ${USER}
echo "${USER}:${PASSWORD}" | chpasswd
echo "Default password set to ${PASSWORD} for ${USER} user."
done < users.txt
replace;password
these;password
users;password
with;password
yours;password
and;password
keep;password
one;password
empty;password
line;password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment