Here is anther way to create multiple user accounts with "useradd" command.
#!/bin/bash
password="123456"
for USER in $(cat example_userlist)
do
useradd -m $USER
echo -e "${password}\n${password}" | passwd $USER
done
The password of all the users is "123456", it can be changed in the second line.In this script, the "example_userlist" is a list of user names, the format of this file is like this:
user1
user2
user3
...
Enjoy!
3 comments:
thank you
hi i have a qus
how do i add the user to a group ?
:)
Hi, Moubarak Adnan Hayal. I am sorry I can't help you with this problem.
Post a Comment