#!/bin/csh -f if ( $#argv < 2 ) then echo 'usage: user username "gecos"' exit 65 endif # Add the group same as the login /usr/sbin/groupadd $1 # Generate a random passwd set passwd=`/usr/bin/pwgen -c -n -N 1` # Convert to crypt set crypt=`/usr/bin/echo $passwd | /usr/bin/pwcrypt -q` # Add the login as default shell (they can change it later) /usr/sbin/useradd -g $1 -c "$2" -m -p $crypt $1 # Echo the password /usr/bin/echo "Password for $1 - $passwd" # Show the uid /usr/bin/id $1