批量添加用户

#!/bin/bash
#The script to add user
#The script to add user
#/etc/passwd info
echo "please input username:"
read name
echo "please input number:"
read num
n=1
while [ $n -le $num     ]
do
        /usr/sbin/useradd $name$n
        n=`expr $n + 1`
done
#/etc/shadow info
echo "please input the password:"
read passwd
m=1
while [ $m -le $num ]                                                                               
do
        echo $passwd | /usr/bin/passwd --stdin $name$m
        m=`expr $m + 1`
done

分割线
感谢打赏
江西数库信息技术有限公司
YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS