创建用户的脚本

    xiaoxiao2021-03-25  107

    #!/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
    转载请注明原文地址: https://ju.6miu.com/read-12436.html

    最新回复(0)