#!/bin/bash chmod 700 /etc/sudoers declare NAME visudo=/usr/sbin/visudo read -p "Please input you want add user in sudo:" OPT NAME=(`echo $OPT | awk 'BEGIN {ORS=" "} {for (i=1;i<=NF;i++) {print $i}}'`) #echo ${NAME} COUNT=$((${#NAME}-1)) for i in `seq 0 $COUNT`; do #cat /etc/sudoers sed -i /^root[]*ALL*/a\ "${NAME} ALL=(ALL) ALL" /etc/sudoers done chmod 440 /etc/sudoers
|