Chinaunix首页 | 论坛 | 博客
  • 博客访问: 547600
  • 博文数量: 201
  • 博客积分: 7734
  • 博客等级: 少将
  • 技术积分: 1994
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-09 19:18
文章分类

全部博文(201)

文章存档

2011年(28)

2010年(173)

分类: LINUX

2010-06-14 13:52:28

1\
------------------------------
#!/bin/bash
#automating user creation
for x in $(seq 1 10); do
echo adding test$x
(
echo -ne "test$x\t"
useradd test$x 2>&1 >/dev/null && passwd test123$x
) >> /tmp/userlog
done
echo 'cat /tmp/userlog to see new passwords'
---------------------------------------

2\
------------------------------------
a\create a file called /home/student/userlist,which contains the username you are about to create.
=======
linsco
uxci
jxzengqinghua
test
roderick
=========
#!/bin/bash
#Script for creating all users defined in the file
#/home/student/userlist
for NAME in $(cat /home/student/userlist)
do
/user/sbin/useradd $NAME
PASSWORD=$(openssl rand -base64 10)
echo $PASSWORD |passwd --stdin $NAME
echo "username:$NAME,password:$PASSWORD"|
mail -s "Account Info" root@example.com
done
-----------------------------------------










阅读(451) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~