How to create a user using command line with setting to create password upon first login?

Solution 1:

If you want them to set the password when they first login, then you're not necessarily worried about "security" until they set their password, so create the users with a generic/default password.

then use the chage command on each account. With a script it should be a simple loop.

-d and -m are used with useradd to define and create the user directory. See man useradd for more help.

This command should be able to be used to add the user and password

# useradd -p $(openssl passwd -1 $PASS) $USER

You can add other parameters to that as needed, like the -d for defining a user directory or -m for creating the user directory