useradd <a href="https://www.baidu.com/s?wd=tom&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3uju-mHf1mHu9uhNbn1Rd0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHb3PH61rjbYPWc3nWDdPjfd" target="_blank" class="baidu-highlight">tom</a> #增加用户,其它参数按需要添加
chpasswd /tmp/user.txt#设置用户密码
rm -f /tmp/user.txt#删除临时密码文件
创建5个用户k1~k5,口令都设置为12345:
#!/bin/bash#设置初始密码
kpasswd="12345"
for kuser in k1 k2 k3 k4 k5
do
useradd $kuser
echo "$kuser:$kpasswd" | chpasswd
echo "用户$kuser建立成功,初始密码是$kpasswd"
done
参考:http://zhidao.baidu.com/question/283117682.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)