[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. HDU2819【二分匹配与矩阵的秩】

    题意: 给出一个矩阵问能否实现对角线全部是1,能的话输出路径,不能的话输出-1 思路: 首先根据矩阵的性质,这一定是一个满秩矩阵,所以只根据行或列交换就一定能实现. 所以行和列构成二分图,然后跑一发匈 ...

  2. lightoj1063【求割点】

    题意不懂啊...... 只知道求割点. #include <bits/stdc++.h> using namespace std; typedef long long LL; typede ...

  3. HDU4791【杂】

    题意: 给你一个从0开始的区间si,每个区间是前闭后开,[ s[i] , s[i+1] ), 然后再给你个一个pi,代表你在区间[ s[i] , s[i+1] )里面买东西的单价是pi,给出的s1一定 ...

  4. Label-Free Proteomic Analysis of Exosomes Secreted from THP-1- Derived Macrophages Treated with IFN‑α Identifies Antiviral Proteins Enriched in Exosomes (文献分享一组-张霞)

    文献名:Label-Free Proteomic Analysis of Exosomes Secreted from THP-1- Derived Macrophages Treated with ...

  5. 【NOIP模拟】序列

    [问题描述] 一个序列被称为有趣的序列是它的所有的子串拥有一个唯一的整数(这个整数在整个序列中只出现过一次).给你一个序列的整数, 问你它是否是有趣的. [输入格式] 第一行 T, 表示数据组数.接下 ...

  6. VRTK3.3.0-004传送

    直线传送: 一.无高度变换传送(VRTK_BasicTeleport) 1丶继续在VRScripts下创建空物体PlayArea,用来挂在传送相关脚本:创建Plane作为传送地面 2丶在PlayAre ...

  7. MyBais中xxMap.xml中的知识点

    添加新的mapper的时候下面两个标红的地方要注意,如果统一约定好命名的话都还好,但是就怕一会这样一会那样的业务代码:总之小心! <!-- spring与mybatis整合配置,扫描所有dao, ...

  8. javascript的学习笔记---复习及学习

    1.javascript包含三大部分(BOM,DOM,ECMAscript) ECMAscript:规定js的语法规范 BOM:Document Object Model 给我们提供了一套完整的操作页 ...

  9. Location replace() 方法

    replace() 方法可用一个新文档取代当前文档. <!DOCTYPE html> <html> <head> <meta charset="ut ...

  10. 百度网盘不限速!VIP视频免费看!这两款插件被无数人安利!

    今天给给位推荐两款,我一直在使用的浏览器插件,简直爆炸!全网VIP视频随意看,所有网页上的视频,你想要的全部都能下载! 这两款插件堪称日常必备插件,只要你使用浏览器,就一定需要下面这些插件功能:快速下 ...