Linux系统下批量创建用户

Linux批量创建用户
[root@ldapserver ~]# for i in $(seq 1 20) ; do useradd -d /home/ldapuser$i ldapuser#i; done
[root@ldapserver ~]# grep ldapuser /etc/passwd
ldapuser1:x:1001:1001::/home/ldapuser1:/bin/bash
ldapuser2:x:1002:1002::/home/ldapuser2:/bin/bash
ldapuser3:x:1003:1003::/home/ldapuser3:/bin/bash
ldapuser4:x:1004:1004::/home/ldapuser4:/bin/bash
ldapuser5:x:1005:1005::/home/ldapuser5:/bin/bash
ldapuser6:x:1006:1006::/home/ldapuser6:/bin/bash
ldapuser7:x:1007:1007::/home/ldapuser7:/bin/bash
ldapuser8:x:1008:1008::/home/ldapuser8:/bin/bash
ldapuser9:x:1009:1009::/home/ldapuser9:/bin/bash
ldapuser10:x:1010:1010::/home/ldapuser10:/bin/bash
ldapuser11:x:1011:1011::/home/ldapuser11:/bin/bash
ldapuser12:x:1012:1012::/home/ldapuser12:/bin/bash
ldapuser13:x:1013:1013::/home/ldapuser13:/bin/bash
ldapuser14:x:1014:1014::/home/ldapuser14:/bin/bash
ldapuser15:x:1015:1015::/home/ldapuser15:/bin/bash
ldapuser16:x:1016:1016::/home/ldapuser16:/bin/bash
ldapuser17:x:1017:1017::/home/ldapuser17:/bin/bash
ldapuser18:x:1018:1018::/home/ldapuser18:/bin/bash
ldapuser19:x:1019:1019::/home/ldapuser19:/bin/bash
ldapuser20:x:1020:1020::/home/ldapuser20:/bin/bash
[root@ldapserver ~]# for i in $(seq 1 20) ; do echo ldapuser$i | passwd --stdin ldapuser$i; done
Changing password for user ldapuser1.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser2.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser3.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser4.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser5.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser6.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser7.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser8.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser9.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser10.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser11.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser12.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser13.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser14.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser15.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser16.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser17.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser18.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser19.
passwd: all authentication tokens updated successfully.
Changing password for user ldapuser20.
passwd: all authentication tokens updated successfully.

怎么从01开始???

posted on 2017-12-12 22:55  遠離塵世の方舟  阅读(1371)  评论(0编辑  收藏  举报

导航