#!/usr/bin/osascript -- License: https://justinpawela.github.io/default-gist-license/ (* 1) Disables signing in as Guest from the login screen. 2) Disables Guest access to file shares over AFP. 3) Disables Guest access to file shares over SMB. Commands are chained together so that the user only needs to authorize once. *) set shellCommands to ¬ "sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool NO; " & ¬ "sudo /usr/bin/defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool NO; " & ¬ "sudo /usr/bin/defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool NO" try -- Run the shell commands, after requesting user authorization. do shell script shellCommands ¬ with prompt "Attempting to disable the Guest user account." ¬ with administrator privileges on error number -128 -- User cancelled. No further action required. end try