Script for adding users

Joined
Jun 4, 2009
Messages
1
Reaction score
0
Points
1
1. I tried creating this script to add users through bash from these two sites, Mac OS X: Creating a new user from the command-line and How to: Add a user from the OS X command line, works with Leopard! - OS X Daily. The important thing about the script is that it creates the user's home directory on an external hard drive connected to the computer. I would like to know if this script will work, as I don't have mac myself and am writing this script for someone else. If this doesn't work, could you please suggest a script that will work.
Code:
#!/bin/sh
echo "Enter username: "
read newuser
echo "Enter the full name for user $newuser: "
read long_name
echo "Enter password for $newuser: "
read password
new_uid=`nidump passwd . | awk -F: '{print $3f}' | sort -n|tail -1`
new_uid=`expr $new_uid + 1`
dscl / -create /Users/$newuser
dscl / -create /Users/$newuser UserShell /bin/bash
dscl / -create /Users/$newuser RealName "$long_name"
dscl / -create /Users/$newuser UniqueID $new_uid
dscl / -create /Users/$newuser PrimaryGroupID (ADD NAME OF GROUP HERE)
dscl / -create /Users/$newuser NFSHomeDirectory /volumes/(ADD EXTERNAL HARD DRIVE NAME HERE)/Users/$newuser
dscl / -passwd /Users/$newuser $password
2. Do users need to be in a group? If so, how could I create a group with no privileges to that the users can only open their home directories on the external hard drive?
3. Is the openSSH sever for mac good?
4. Can anyone recommend a client that is easy to use for a non-technical person?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top