[root@localhost wyb]# cat user10.sh
#!/bin/bash
#批量创建10个系统帐号wangyb01-wangyb10并设置密码(密码为随机8位字符串)。
>user.list
for user in `seq -w `
do useradd wangyb$user
password=`echo $RANDOM|md5sum|cut -c -`
echo $password|passwd wangyb$user --stdin
echo wangyb$user $password >> user.list
done [root@localhost wyb]# bash user10.sh
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb01.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb02.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb03.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb04.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb05.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb06.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb07.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb08.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb09.
passwd: all authentication tokens updated successfully.
Creating mailbox file: File exists
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
Changing password for user wangyb10.
passwd: all authentication tokens updated successfully.
[root@localhost wyb]# cat user.list
wangyb01 77950e07
wangyb02 ace3cfb1
wangyb03 2cd63081
wangyb04 0f891e3c
wangyb05 600bedd4
wangyb06 73d3dfdc
wangyb07
wangyb08 54cf685f
wangyb09 ee3f88af
wangyb10 b54d2555
[root@localhost wyb]# su wang01
su: user wang01 does not exist
[root@localhost wyb]# su wangyb01
[wangyb01@localhost wyb]$ su wangyb10
Password:
[wangyb10@localhost wyb]$ [root@localhost wyb]# cat deluser10.sh
#!/bin/bash
#批量删除10个系统帐号wangyb01-wangyb10并设置密码(密码为随机8位字符串)。
> user.list
for user in `seq -w `
do userdel wangyb$user
done [root@localhost wyb]# bash deluser10.sh
[root@localhost wyb]# su wangyb01
su: user wangyb01 does not exist
[root@localhost wyb]#

shell脚本,批量创建10个系统帐号并设置密码为随机8位字符串。的更多相关文章

  1. 批量创建10个系统帐号tianda01-tianda10并设置密码

    #.添加用户 useradd tianda01 #.非交互式给密码 echo "pass"|passwd --stdin tianda #.- 加0思路 ()..} () #随机密 ...

  2. Shell 脚本批量创建数据库表

    使用 Shell 脚本批量创建数据表 系统:Centos6.5 64位 MySQL版本:5.1.73 比如下面这个脚本: #!/bin/bash #批量新建数据表 for y in {0..199}; ...

  3. Linux shell脚本 批量创建多个用户

    Linux shell脚本 批量创建多个用户 #!/bin/bash groupadd charlesgroup for username in charles1 charles2 charles3 ...

  4. 案例九:shell脚本自动创建多个新用户,并设置密码

    此脚本是用来批量创建用户并设置用户密码,在企业用非常实用. 脚本一 #!/bin/bash for name in $( seq 1 100 ) do useradd "user$name& ...

  5. shell脚本批量创建用户

    #!/bin/bash DATE=$(date +%F_%T) USER_FILE=user.txt echo_color() { == "green" ];then echo - ...

  6. 基于Andoird 4.2.2的Account Manager源代码分析学习:创建选定类型的系统帐号

    AccountManager.addAccount() public AccountManagerFuture<Bundle> addAccount(final String accoun ...

  7. shell脚本,在指定目录下通过随机小写10个字母加固定字符串oldboy批量创建10个html文件。

    [root@localhost wyb]# cat test10.sh #!/bin/bash #使用for循环在/test10目录下通过随机小写10个字母加固定字符串oldboy批量创建10个htm ...

  8. linux系统配置文件或shell脚本批量注释

    1. 配置文件批量注释 1.1 批量注释 ① 进入命令行模式,按ctrl + v进入 visual block模式,键盘上下箭头选中多行,把需要注释的行标记起来 ② 按大写字母I,再输入注释符:# ③ ...

  9. 批量创建10个用户stu01-stu10

    1.批量创建10个用户stu01-stu10,并且设置随机8位密码,要求不能用shell循环(例如:for,while等),只能用命令及管道实现. ##方法1: [root@server tmp]# ...

随机推荐

  1. Unity2D研究院之自动生成动画、AnimationController、Prefab(一)

    http://www.xuanyusong.com/archives/3243 国庆了,回家了.时刻还是要吃一颗学习的心,在家了也要抽出时间好好学习一下.之前MOMO一直没研究过Unity2D,今天研 ...

  2. element走过的坑

    1.想要更改表头颜色,只要在el-table里引入 :header-cell-style="{background:'red'}" 2.el-form自定义表单验证 , 但是左边不 ...

  3. assembly x86(nasm)选择排序

    有一个首地址为NUM的N字无序无符号整数数组,编制程序采用选择排序法使该数组中的数按照从小到大的次序排序输出. 选择排序: data segment message db 'This is a pro ...

  4. react native 获取地图需要的SHA1

    1.从电脑的根目录进入.android文件 2.进入.android文件后输入 keytool -v -list -keystore debug.keystore 3.回车输入密码,(可以直接回车不用 ...

  5. Devc++贪吃蛇

    使用Devc++写的一个简单版贪吃蛇程序,不过,在未配置之前,是不包含图形库的,所以需要自己配置新的环境 ----------------------------------------------- ...

  6. spring+mybits 整合所需jar包的下载路径(亲测有效)

    1.spring jar包:http://repo.springsource.org/libs-release-local/org/springframework/spring/5.0.0.RELEA ...

  7. SpringMVC-高级参数绑定

    绑定数组 需求 在商品列表页面选中多个商品,然后删除. 需求分析 此功能要求商品列表页面中的每个商品前有一个checkbook,选中多个商品后点击删除按钮把商品id传递给Controller,根据商品 ...

  8. php pack、unpack、ord 函数使用方法(二进制流接口应用实例)

    在工作中,我也逐渐了解到pack,unpack,ord对于二进制字节处理的强大. 下面我逐一介绍它们.在我们工作中,用到它们的估计不多. 我在最近一个工作中,因为通讯需要用到二进制流,然后接口用php ...

  9. MongoDB内置文档查看和修改

    MongoDB设计的时候,有时候会设计内置文档,方便某个对象的统一.在这里略写了查看内置文档和更新内置文档. 1.查看  表为:realtimelogin   realName为:123 realpa ...

  10. [Luogu1343]地震逃生 最大流

    题目链接:https://www.luogu.org/problem/show?pid=1343 dinic跑最大流. #include<cstdio> #include<cstri ...