Created
June 16, 2020 12:01
-
-
Save Creased/9995d728e6590aeeef1333a3b2dd4765 to your computer and use it in GitHub Desktop.
Bulk user creation (with sudo)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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