Monday, May 2, 2011

User Creation Script

automate the process of user extraction and user creation
username
comment
home directory
group
password
confirm password
echo username; read un
if [ -z "$un" ]
then
 echo "Username is NULL"
else
 echo comment note: requestor name and date and time and business name if exists; read co
 if [ -z "$co" ]
 then
  echo "Comment is NULL"
 else
  echo home directory; read hd
  if [ -z "$hd" ]
  then
   echo "Home directory is NULL"
  else
   echo group; read gr
   if [ -z "$gr" ]
   then
    echo "Group is NULL"
   else
    useradd -g $gr -m -d $hd -c $co $un
    passwd $un
   fi
  fi
 fi
fi

No comments:

Post a Comment