#!/usr/bin/sh # definitions skeldir=/etc/skel homedir=/temphome shelldir=/usr/bin # prompt for info echo What is the username? read username echo What shell? read shell tail /etc/passwd echo What UID? read uid tail /etc/group echo What GID? read gid # create homedir mkdir ${homedir}/${username} clear echo adding user... # now run useradd with the provided info useradd -g ${gid} -u ${uid} -s ${shelldir}/${shell} -d ${homedir}/${username} ${username} # now that they exist, give them their dir! # copy over the skelfiles cp ${skeldir}/.* ${homedir}/${username} chown -R ${username} ${homedir}/${username} chgrp -R ${gid} ${homedir}/${username} echo passwd ${username}