Creating new System users for Panther and Postfix
If you use radmind to upgrade a machine from 10.2.x
to 10.3, several system users will not be created (unless the NetInfo database
is not in your negative transcript). Without these users, postfix (the new mail
transfer agent - it replaces sendmail) will not work. Other services may also
be affected. Here's how you can automate creating those needed users and
groups.
This fix was made easier by poking around on the
Panther Install disk 1, looking at the Install packages, and looking at the
scripts buried in the Resources. There is one called CreateSystemUsers that
served as the basis for this script. Again, I run this as part of a custom
StartupItem.
##################################################################
# check for and create system users needed by 10.3 when
# upgraded from 10.2
##################################################################
ConsoleMessage "Validating System Users"
# Add cyrus user
nicl . -read /users/cyrus >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /users/cyrus
nicl . -createprop /users/cyrus uid 77
nicl . -createprop /users/cyrus gid 6
nicl . -createprop /users/cyrus passwd '*'
nicl . -createprop /users/cyrus change 0
nicl . -createprop /users/cyrus expire 0
nicl . -createprop /users/cyrus realname 'Cyrus IMAP User'
nicl . -createprop /users/cyrus home '/var/imap'
nicl . -createprop /users/cyrus shell '/usr/bin/false'
nicl . -createprop /users/cyrus _writers_passwd 'cyrus'
echo "niutil: User 'eppc' added."
fi
# add the eppc user
nicl . -read /users/eppc >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /users/eppc
nicl . -createprop /users/eppc uid 71
nicl . -createprop /users/eppc gid 71
nicl . -createprop /users/eppc passwd '*'
nicl . -createprop /users/eppc change 0
nicl . -createprop /users/eppc expire 0
nicl . -createprop /users/eppc realname 'Apple Events User'
nicl . -createprop /users/eppc home '/var/empty'
nicl . -createprop /users/eppc shell '/usr/bin/false'
nicl . -createprop /users/eppc _writers_passwd 'eppc'
echo "niutil: User 'eppc' added."
fi
# add the lp user
nicl . -read /users/lp >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /users/lp
nicl . -createprop /users/lp uid 26
nicl . -createprop /users/lp gid 26
nicl . -createprop /users/lp passwd '*'
nicl . -createprop /users/lp change 0
nicl . -createprop /users/lp expire 0
nicl . -createprop /users/lp realname 'Printing Services'
nicl . -createprop /users/lp home '/var/spool/cups'
nicl . -createprop /users/lp shell '/usr/bin/false'
nicl . -createprop /users/lp _writers_passwd 'lp'
echo "niutil: User 'lp' added."
fi
# add the lp group
nicl . -read /groups/lp >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /groups/lp
nicl . -createprop /groups/lp gid 26
nicl . -createprop /groups/lp passwd '*'
echo "niutil: Group 'lp' added."
fi
# add the mailman user
nicl . -read /users/mailman >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /users/mailman
nicl . -createprop /users/mailman uid 78
nicl . -createprop /users/mailman gid 78
nicl . -createprop /users/mailman passwd '*'
nicl . -createprop /users/mailman change 0
nicl . -createprop /users/mailman expire 0
nicl . -createprop /users/mailman realname 'Mailman user'
nicl . -createprop /users/mailman home '/var/empty'
nicl . -createprop /users/mailman shell '/usr/bin/false'
nicl . -createprop /users/mailman _writers_passwd 'mailman'
echo "niutil: User 'mailman' added."
fi
# add the mailman group
nicl . -read /groups/mailman >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /groups/mailman
nicl . -createprop /groups/mailman gid 78
nicl . -createprop /groups/mailman passwd '*'
echo "niutil: Group 'mailman' added."
fi
# add the postfix user
nicl . -read /users/postfix >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /users/postfix
nicl . -createprop /users/postfix uid 27
nicl . -createprop /users/postfix gid 27
nicl . -createprop /users/postfix passwd '*'
nicl . -createprop /users/postfix change 0
nicl . -createprop /users/postfix expire 0
nicl . -createprop /users/postfix realname 'Postfix User'
nicl . -createprop /users/postfix home '/var/spool/postfix'
nicl . -createprop /users/postfix shell '/usr/bin/false'
nicl . -createprop /users/postfix _writers_passwd 'postfix'
echo "niutil: User 'postfix' added."
fi
# add the postfix group
nicl . -read /groups/postfix >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /groups/postfix
nicl . -createprop /groups/postfix gid 27
nicl . -createprop /groups/postfix passwd '*'
echo "niutil: Group 'postfix' added."
fi
# add the postdrop group
nicl . -read /groups/postdrop >/dev/null 2>&1
if [ $? != 0 ] ; then
nicl . -create /groups/postdrop
nicl . -createprop /groups/postdrop gid 28
nicl . -createprop /groups/postdrop passwd '*'
echo "niutil: Group 'postdrop' added."
fi
This last bit is not strictly related to the creation of missing system users, but if you want Postfix to operate as a way for processes to send outgoing mail to an external mailserver, you'll need to make a change to the /etc/hostconfig file:
##################################################################
# turn on postfix-on-demand in the hostconfig file
##################################################################
if [ "${MAILSERVER:=-NO-}" = "-NO-" ]; then
echo "Starting
Postfix"
cp /etc/hostconfig /etc/hostconfig.bak
grep -v MAILSERVER /etc/hostconfig.bak > /etc/hostconfig
echo "MAILSERVER=-AUTOMATIC-" >> /etc/hostconfig
# start postfix to create the needed directories and pipes in /private/var/spool/postfix
/usr/sbin/postfix start
# now we can stop postfix
/usr/sbin/postfix stop
# finally start the mail queue watcher
/usr/sbin/postfix-watch
fi
Posted: Wed - November 12, 2003 at 10:25 PM