Linux, batch create user

There is a need to finally met the needs of a large number of users to create, and hereby record

Batch add users using useradd

Proceed as follows:
1) to create a user name list file user_list

$ vim user_list

stu1
stu2
stu3
stu4
stu5

2) Create a user password corresponding to the file user_pwd_list, the format username: password (note file format)

vim user_pwd_list

stu1:tt1
stu2:tt2
stu3:tt3
stu4:tt4
stu5:tt5

3) add a user, and generated for the user in the user directory / home / lower.

cat < user_list | xargs -n 1 useradd -m

Update password 4) batch mode

chpasswd < user_pwd_list

5) cryptographic transformation to the password and group files

pwconv

Guess you like

Origin blog.51cto.com/huanghai/2430015
Recommended