纯linux命令批量创建用户并设置随机密码且显示用户和密码的脚本
2017-04-10 20:58
806 查看
##deleate
rm -f /root/user_password.txt /root/user_names.txt /root/user_list.txt
##create stu01-stu10
echo stu{01..10}|xargs -n1 >> /root/user_names.txt
##create users stu01-stu10 and build password
cat /root/user_names.txt|sed 's#.*#useradd &;echo $RANDOM |md5sum|cut -c 1-8 >>/root/user_password.txt;tail -1 /root/user_password.txt |passwd --stdin g'|bash
###log name and password
cat /root/user_names.txt |xargs -n10 >/root/user_list.txt && cat /root/user_password.txt |xargs -n10 >>/root/user_list.txt
###show the list
cat /root/user_list.txt
rm -f /root/user_password.txt /root/user_names.txt /root/user_list.txt
##create stu01-stu10
echo stu{01..10}|xargs -n1 >> /root/user_names.txt
##create users stu01-stu10 and build password
cat /root/user_names.txt|sed 's#.*#useradd &;echo $RANDOM |md5sum|cut -c 1-8 >>/root/user_password.txt;tail -1 /root/user_password.txt |passwd --stdin g'|bash
###log name and password
cat /root/user_names.txt |xargs -n10 >/root/user_list.txt && cat /root/user_password.txt |xargs -n10 >>/root/user_list.txt
###show the list
cat /root/user_list.txt
相关文章推荐
- shell脚本批量创建用户,并指定随机密码
- Linux下如何批量创建用户并设置8位随机密码
- shell脚本创建用户并设置密码
- Shell脚本批量创建用户并随机生成密码
- VBS脚本批处理创建域用户【可自动设置用户密码,创建OU】[转]
- linux学习笔记-批量创建用户并设置随机密码
- Shell脚本批量创建用户并随机生成密码
- Shell脚本批量创建用户并随机生成密码
- 批量创建用户并设置随机密码
- shell脚本:批量添加用户,并设置随机字符为密码
- Shell脚本——创建用户和设置密码
- 老男孩教育每日一题-第63天-批量创建用户并设置随机密码(要求不能使用shell循环语句)
- shell 脚本 批量创建用户密码随机
- 创建用户设置随机密码
- shell脚本-批量添加用户并设置随机密码
- Shell脚本批量创建用户并随机生成密码
- shell脚本创建用户并设置密码
- 创建5个用户并设置随机密码
- Shell创建用户并生成随机密码脚本分享