Created
June 3, 2015 14:21
-
-
Save neilmartin83/0425e4bb329ad07d0403 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Script to prevent login of users | |
#As of OS X 10.9 MCX- and profile-based methods for this do not seem to be working | |
#Code borrowed from https://jamfnation.jamfsoftware.com/discussion.html?id=4591 | |
#Exclude authorised users and groups in the policy scope | |
user=$USER #Use existing Casper variable for user | |
heading=$'You are not authorised to use this facility.' | |
description=$'This is a specialist facility available only to selected students and staff within ADI.' | |
icon='/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarDeleteIcon.icns' | |
echo "$user is not authorised to use this Mac. Killing login session..." | |
/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType fs -heading "$heading" -icon "$icon" -description "$description" -alignHeading centre & | |
sleep 10 | |
killall jamfHelper | |
kill `ps -ef | fgrep loginwindow | grep -v grep | awk '{print $2}'` | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be called by a Casper Policy that's scoped to all groups, excluding ones that are allowed to log in to the client. Or you could scope it to limit to users/groups you don't want to log in...