Skip to content

Instantly share code, notes, and snippets.

@grenade
Last active April 16, 2018 16:23
Show Gist options
  • Save grenade/6317902 to your computer and use it in GitHub Desktop.
Save grenade/6317902 to your computer and use it in GitHub Desktop.
Create multiple new user accounts on Linux, set passwords to match usernames, force password change at first login and add users to some-user-group.
for username in foo bar baz qux
do
/usr/sbin/useradd $username
echo $username | passwd $username --stdin
chage -d 0 $username
/usr/sbin/usermod -a -G some-user-group $username
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment