shell下批量创建10个系统账号(user01-user10),并设置密码(密码为随机数,要求是字符和数字的混合)。

亲测有效

[root@localhost ~]# seq -w 10
01
02
03
04
05
06
07
08
09
10
[root@localhost ~]# useradd oldgirl
[root@localhost ~]# echo 123456|passwd --stdin oldgirl
Changing password for user oldgirl.
passwd: all authentication tokens updated successfully.
[root@localhost ~]# echo $RANDOM|md5sum
16ca779451126ed7a63769b3fb63a059 -
[root@localhost ~]# echo $RANDOM|md5sum|cut -c 5-12
46dcbcb7
[root@localhost ~]# vim 11_14_1.sh
[root@localhost ~]# cat 11_14_1.sh
#!/bin/sh
#author:oldboy
#blog:http:/olaboy.blog51cto.com
user=“oldboy”
passfile="/tmp/user.log"
for num in seq -w 10
do
useradd

猜你喜欢

转载自blog.csdn.net/qq_45930145/article/details/107195631