mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
20142a2508
svn:r3299
43 lines
1.5 KiB
Bash
Executable File
43 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Original adduser 05 Feb 2002 by Jon L. Gardner
|
|
#
|
|
# Modified for Tor installer by Nick Mathewson
|
|
|
|
if [ "`whoami`" != "root" ]; then
|
|
echo "You must be root to execute this script."
|
|
exit
|
|
fi
|
|
if [ "x$3" = "x" ]; then
|
|
echo 'Usage: addsysuser <username> "<full name>" <homedir>'
|
|
exit 0
|
|
fi
|
|
username=$1
|
|
realname=$2
|
|
homedir=$3
|
|
# GID 20 is "staff" which is the default. Change it if you want.
|
|
gid=`niutil -readprop / /groups/daemon gid`
|
|
if [ "x`niutil -list / /users|cut -f2 -d' '|grep $username`" != "x" ]; then
|
|
echo The account $username already exists.
|
|
exit 0
|
|
fi
|
|
# home is the local path to the home directory
|
|
home=/Users/$username
|
|
# defhome is what goes into NetInfo
|
|
defhome="/Network/Servers/MyServer/Users"
|
|
#echo "Determining next available uid (please be patient)..."
|
|
uiddef=`nidump passwd / | cut -d: -f3 | sort -n | tail -n 1`
|
|
uiddef=`echo $uiddef + 1 |bc`
|
|
echo Creating account for $username...
|
|
niutil -create / /users/$username
|
|
niutil -createprop / /users/$username _writers_tim_passwd $username
|
|
niutil -createprop / /users/$username realname $realname
|
|
niutil -createprop / /users/$username _writers_passwd $username
|
|
niutil -createprop / /users/$username uid $uiddef
|
|
#niutil -createprop / /users/$username home_loc "<home_dir><url>afp://afp.server.com/Users/</url><path>$username</path></home_dir>"
|
|
niutil -createprop / /users/$username gid $gid
|
|
niutil -createprop / /users/$username home $homedir
|
|
niutil -createprop / /users/$username name $username
|
|
niutil -createprop / /users/$username passwd '*'
|
|
niutil -createprop / /users/$username shell /dev/null
|