批量添加用户
时间:2010-09-13 来源:xindi10631
#!/bin/sh
i=8000
while [ $i -le 8020 ]
do
useradd $i
echo "123456" | passwd --stdin $i &> /dev/null
i=`expr $i+1 | bc`
done [root@chen shekk]# cat file
1 1
2 2
3 3
4 4
5 5 [root@chen shekk]# cat yh
#!/bin/sh
while read u p
do
useradd $u
echo $p | passwd --stdin $u &> /dev/null
done < file
[root@chen shekk]# tail -5 /etc/passwd
1:x:527:533::/home/1:/bin/bash
2:x:528:534::/home/2:/bin/bash
3:x:529:535::/home/3:/bin/bash
4:x:530:536::/home/4:/bin/bash
5:x:531:537::/home/5:/bin/bash
[root@chen shekk]#
i=8000
while [ $i -le 8020 ]
do
useradd $i
echo "123456" | passwd --stdin $i &> /dev/null
i=`expr $i+1 | bc`
done [root@chen shekk]# cat file
1 1
2 2
3 3
4 4
5 5 [root@chen shekk]# cat yh
#!/bin/sh
while read u p
do
useradd $u
echo $p | passwd --stdin $u &> /dev/null
done < file
[root@chen shekk]# tail -5 /etc/passwd
1:x:527:533::/home/1:/bin/bash
2:x:528:534::/home/2:/bin/bash
3:x:529:535::/home/3:/bin/bash
4:x:530:536::/home/4:/bin/bash
5:x:531:537::/home/5:/bin/bash
[root@chen shekk]#
相关阅读 更多 +