Example Login Hook Scripts for Mac OS X
These scripts are examples. Full scripts should include error checking and comments.
This is the simplest login hook. It returns TRUE, which means all users can log in.
#!/bin/bash echo "ok" exit 0
This script restricts login to only one user with the EID "joe."
if test $1 = "joe" ; then echo "ok" exit 0 fi echo "not ok" exit 1
This script allows members of the local admin group to login by using the dscl command to check group permissions.
inGroup=`dscl . -search /Groups GroupMembership $1 | grep admin` if test ! "$inGroup" ; then echo "not ok" exit 1
This final example maps arbitrary Active Directory groups to the local administrative group, allowing the resulting set of users to administer the computer.
theGroup=appserveradm inGroup=`dscl . -search /Groups GroupMembership $1 | grep $theGroup`
Last updated June 12, 2012 @ 3:18 pm