creating remoteuser

darshan jadav root.devil at gmail.com
Thu Mar 17 12:44:26 UTC 2005


Hi all

I m making script to automate remote server user creation, using sudo,
this is my sript, something is not working out or parts missing, am
very new 2 bash scripting, plz help
Am not able to complete the script, plz tell me where i am going wrong...

Thanks a lot

---------------------------------------------------------------------------------------------------------------------
echo Checking for the user file
echo
grep ^$1: /home/dj/list > /dev/null 2>&1
if [ "$?" -eq 0 ]; then
        echo " User file not found" >&2
        exit 1
fi
echo
echo -e "Enter Hostname:"
read -e HOST
PASSWORD="test"
NEW_USERS="/home/dj/list"
cat ${NEW_USER}|\
while read USER GROUP PASSWORD FULL NAME
do
#echo  "Enter Hostname"
#read -e HOST
ssh $HOST |\
sudo /usr/sbin/useradd -G ${GROUP} -p ${PASSWORD} ${USER} -c "${FULL} ${NAME}"
$PASSWORD
done
-----------------------------------------------------------------------------------------------------------------------




More information about the redhat-list mailing list