Create a list of users via script

This has not been tested yet.

#!/usr/bin/ksh

NEW_USERS="/path/to/text_data_file"
HOME_BASE="/home/"

cat ${NEW_USERS} | \
while read USER PASSWORD GROUP
do
useradd -g ${GROUP} -p ${PASSWORD} -m -d ${HOME_BASE}${USER} ${USER}

#echo "$pass" | useradd -p "$name"
echo "$PASSWORD" | smbpasswd -as "$USER"

(echo $PASSWORD; echo $PASSWORD)| smbpasswd -s -a $USER_NAME)


done


Tag Cloud