Restricting login to account based on IP address
At work we needed to have a standard local account that would work off campus, but not on campus. Here was my solution.
First I check for the user and create it if it doesn't exist
user_exists=`dscl . -read /Users/remote GeneratedUID | grep -c GeneratedUID`
if [ $user_exists -ne ...