批量添加 linux用户(备忘)

1、编辑文件batchAddUsers.txt

cd ~
vim batchAddUsers.txt

 

batchAddUsers.txt:
userName1:passwd1:userId1:groupId1:description1:/bin/bash
userName2:passwd2:userId2:groupId2:description2:/bin/bash

 

2、通过newusers命令来导入用户

/usr/sbin/newusers ~/batchAddUsers.txt

 

* 需要有超级用权限

 

 

需要修改密码的情况:

1、关闭密码加密功能

/usr/sbin/pwunconv

2、编辑batchChangePw.txt

vim ~/batchChangePw.txt
batchChangePw.txt:
user_test1:passwd1
user_test1:passwd2

3、导入修改密码

chpasswd ~/batchChangePw.txt

4、开启密码加密

/usr/sbin/pwconv

 

posted @ 2017-02-06 10:04  gabin  阅读(184)  评论(0编辑  收藏  举报