#!/usr/bin/bash

#Tate:2022.4.11
#Author:Yingjian
#function:  一键创建sudo用户
#env
#name=$1
name=yingjian
#pass=$2 自定义密码
pass=********

id $name
if [ $? -ne 0 ];then
useradd $name
usermod -aG wheel yingjian
echo $pass |passwd --stdin $name
else
echo "$name 该用户已创建 请修改脚本变量"
exit 3
fi
#打开/etc/sudoers文件中wheel组免密登录
sed -i 's@^# %wheel.*@\%wheel    ALL=(ALL)    NOPASSWD:    ALL@' /etc/sudoers


