123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 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=`dscl . -read /groups/daemon gid`
- echo $gid
- if [ "x`dscl . -list /users|cut -f2 -d' '|grep $username`" != "x" ]; then
- echo The account $username already exists.
- exit 0
- fi
- home=/Users/$username
- defhome="/Network/Servers/MyServer/Users"
- echo Creating account for $username...
- dscl . -create /users/$username
- dscl . -create /users/$username _writers_tim_passwd $username
- dscl . -create /users/$username realname $realname
- dscl . -create /users/$username _writers_passwd $username
- dscl . -create /users/$username gid $gid
- dscl . -create /users/$username home $homedir
- dscl . -create /users/$username name $username
- dscl . -create /users/$username passwd '*'
- dscl . -create /users/$username shell /dev/null
|