3 # Original adduser 05 Feb 2002 by Jon L. Gardner
5 # Modified for Tor installer by Nick Mathewson
9 if [ "`whoami`" != "root" ]; then
10 echo "You must be root to execute this script."
13 if [ "x$3" = "x" ]; then
14 echo 'Usage: addsysuser <username> "<full name>" <homedir>'
20 # GID 20 is "staff" which is the default. Change it if you want.
21 gid
=`niutil -readprop $ROOTPROP /groups/daemon gid`
22 if [ "x`niutil -list $ROOTPROP /users|cut -f2 -d' '|grep $username`" != "x" ]; then
23 echo The account
$username already exists.
26 # home is the local path to the home directory
28 # defhome is what goes into NetInfo
29 defhome
="/Network/Servers/MyServer/Users"
30 #echo "Determining next available system uid (please be patient)..."
31 # Uids over 500 are for system users.
32 uiddef
=`nidump passwd / | cut -d: -f3 | sort -n | grep -v '^[56789]..' |grep -v '^....$' | tail -n 1`
33 uiddef
=`echo $uiddef + 1 |bc`
34 echo Creating account
for $username...
35 niutil
-create $ROOTPROP /users
/$username
36 niutil
-createprop $ROOTPROP /users
/$username _writers_tim_passwd
$username
37 niutil
-createprop $ROOTPROP /users
/$username realname
$realname
38 niutil
-createprop $ROOTPROP /users
/$username _writers_passwd
$username
39 niutil
-createprop $ROOTPROP /users
/$username uid
$uiddef
40 #niutil -createprop $ROOTPROP /users/$username home_loc "<home_dir><url>afp://afp.server.com/Users/</url><path>$username</path></home_dir>"
41 niutil
-createprop $ROOTPROP /users
/$username gid
$gid
42 niutil
-createprop $ROOTPROP /users
/$username home
$homedir
43 niutil
-createprop $ROOTPROP /users
/$username name
$username
44 niutil
-createprop $ROOTPROP /users
/$username passwd
'*'
45 niutil
-createprop $ROOTPROP /users
/$username shell
/dev
/null