批量创建用户并设置密码不为相同
站在用户的角度思考问题,与客户深入沟通,找到麟游网站设计与麟游网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站建设、网站制作、企业官网、英文网站、手机端网站、网站推广、申请域名、虚拟空间、企业邮箱。业务覆盖麟游地区。#!/bin/bash for n in `seq -w 10` do useradd xcn$n&&\ echo "root$n"|passwd --stdin xcn$n done 执行结果: [root@XCN for]# sh test7.sh Changing password for user xcn01. passwd: all authentication tokens updated successfully. Changing password for user xcn02. passwd: all authentication tokens updated successfully. Changing password for user xcn03. passwd: all authentication tokens updated successfully. Changing password for user xcn04. passwd: all authentication tokens updated successfully. Changing password for user xcn05. passwd: all authentication tokens updated successfully. Changing password for user xcn06. passwd: all authentication tokens updated successfully. Changing password for user xcn07. passwd: all authentication tokens updated successfully. Changing password for user xcn08. passwd: all authentication tokens updated successfully. Changing password for user xcn09. passwd: all authentication tokens updated successfully. Changing password for user xcn10. passwd: all authentication tokens updated successfully.
批量创建用户并设置密码为随机
方法1:
#!/bin/bash for n in `seq -w 10` do pass=`echo "$RANDOM"|md5sum|cut -c 1-8` useradd xcn$n&&\ echo "$pass" |passwd --stdin xcn$n echo -e "xcn$n\t $pass" >>/data/pass.log done
批量删除用户
#!/bin/bash for n in `seq 10` do userdel -r xcn$n &&\ done
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。