Script enabling/disabling the guest account on OS X


It would appear that you could just enable or disable the guest account by using defaults write in the /Library/Preferences/com.apple.loginwindow.plist file, but apparently that just changes how it displays in System Preferences > Users & Groups.

Scripted Solution

There is a lot that goes on behind the scenes, and this script actually does it (almost) all:
github.com/sheagcraig/guestAccount/blob/master/guest_account

rtrouton has another version of this available, too:
gist.github.com/rtrouton/8016797

Ready for Munki

I took a modified version of that (without the Lion checks) and cut it up to be a nopkg .plist for Munki:
github.com/aysiu/munkiscripts/blob/main/nopkg/EnableGuestAccount.plist

Workaround for Keychain Issue

Now that the keychain issue is “fixed,” you have to hit Enter at the password prompt (instead of just logging in right away), but there is no keychain error at least. Props to this JAMF Nation discussion for the workaround for the keychain error.

Keychain Issue

The only downside is that it gives a keychain error: guestkeychain

I’ll have to experiment a bit to see if I can get that error message to not appear.


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.