创建用户的脚本
来源:互联网 发布:光纤网络布线认识 编辑:程序博客网 时间:2024/05/21 19:17
#!/bin/bash
if [ ! -f /mnt/userfile ]; then
echo "the userfile not exist"
exit 0
fi
if [ ! -f /mnt/passfile ]; then
echo "the passfile not exist"
exit 0
fi
MAXUSERLINE=$(cat /mnt/userfile |wc -l)
MAXPASSLINE=$(cat /mnt/passfile |wc -l)
if [ "$MAXUSERLINE" != "$MAXPASSLINE" ]; then
echo "the two file is not equal"
exit 0
fi
for NUM in $(seq 1 $MAXUSERLINE)
do
USER=` sed -n ${NUM}p /mnt/userfile`
PASS=` sed -n ${NUM}p /mnt/passfile`
useradd $USER &>/dev/null
if [ "$?" != "0" ]; then
echo "the user is exist"
else
echo $PASS | passwd --stdin $USER
fi
done
if [ ! -f /mnt/userfile ]; then
echo "the userfile not exist"
exit 0
fi
if [ ! -f /mnt/passfile ]; then
echo "the passfile not exist"
exit 0
fi
MAXUSERLINE=$(cat /mnt/userfile |wc -l)
MAXPASSLINE=$(cat /mnt/passfile |wc -l)
if [ "$MAXUSERLINE" != "$MAXPASSLINE" ]; then
echo "the two file is not equal"
exit 0
fi
for NUM in $(seq 1 $MAXUSERLINE)
do
USER=` sed -n ${NUM}p /mnt/userfile`
PASS=` sed -n ${NUM}p /mnt/passfile`
useradd $USER &>/dev/null
if [ "$?" != "0" ]; then
echo "the user is exist"
else
echo $PASS | passwd --stdin $USER
fi
done
0 0
- 创建用户的脚本
- oracle 创建当前database的用户脚本
- Oracle的默认用户及其创建脚本
- sybase创建用户数据库的脚本
- oracle创建用户脚本
- 创建本地用户脚本
- 创建用户脚本
- 用户自动创建脚本
- 用户创建脚本
- 一个创建用户的简单的shell脚本
- Linux的学习笔记06:批量创建用户的脚本
- shell oracle 创建用户脚本
- 创建linux 用户登录脚本
- linux自动创建用户脚本
- shell脚本自动创建用户
- shell脚本 - 自动创建用户
- 用脚本批量创建用户
- Oracle批量创建用户和导入导出的脚本
- Android Studio中Butterknife使用教程
- 我只是一个线程
- Python-第三方库requests详解
- 输入一个数组,判断能否抽取三个数,余下的数正好以抽取数的位置将原始数组四等分
- 高性能Web服务器Nginx的配置与部署研究(13)应用模块之Memcached模块+Proxy_Cache双层缓存模式
- 创建用户的脚本
- git检出指定子目录和指定文件的实现
- 贴一段POI导出代码----POI使用注意事项更新。20170323更新使用
- 机器学习之 损失函数和风险函数
- Linux下Redis的安装和部署
- flume从本地读取数据录入到hdfs文件系统
- C#数组、结构和类学习
- [MySQL]
- bzoj1629[Usaco2007 Demo]Cow Acrobats