Enabling the screen saver for smart card removal

Currently, we don't have a group policy to enable the screen saver when the smart card is removed. Please use the group policy entitled "Specify multiple login scripts" to deploy the following script:

Copy
#!/bin/bash
user_name=`ls -l /dev/console | cut -d " " -f 4`
defaults write /Users/$user_name/Library/Preferences/com.apple.screensaver tokenRemovalAction -int 1
chown $user_name:staff /Users/$user_name/Library/Preferences/com.apple.screensaver.plist
exit 0

The script sets the Mac to start the screen saver automatically when the smart card is removed.