shell script for mkuser

shell script for mkuser

Post by Remo Corna » Sat, 24 Oct 1998 04:00:00



The following script, although it is interactive, (instead of reading
a file) served me well, when I had to add lots of users to our POP
Server.
It was written by Monica Corigliano.
/userid must be initialized once, by hand, with the first UID to be
used for the new users.
/benv contained a wellcome message for the new E-Mail users.
/w3.aliases is a copy of the aliases file in the Sendmail Server,
grepped to look for possible sinonyms.

#!/bin/ksh
clear

id=`cat /userid`

mkuser id=$id pgrp='pop' su='false' shell='/bin/false' $1

echo
echo Changing passwd for this new user
echo

passwd $1

echo
echo Sending welcome message

mail -s "Welcome !" $1 < benv

echo
echo "--->>> Remember to update the aliases file! <<<---"
echo

grep $1 w3.aliases
#
# Update next userid to be used
((newid = $id + 1))
echo $newid > /userid