This question already has an answer here:
- Run adduser non-interactively 2 answers
I need to add many users on a Ubuntu machine. Is there a way to add a list of users using a text file?
adduser it always asks for an individual password and extra information, else I would do something like
while read p; do sudo adduser $p; done < users.txt
where users.txt contains something like:
username1 username2 ...
So the referenced solution is one step forward:
while read p; do sudo adduser --disable-password --gecos "" $p; done < users.txt
However I cannot set a default password for all of the users in the list. Else I would have to manually set a password for every user. Any idea how to fix that?