Currently Being ModeratedFeb 29, 2012 11:39 AM (in response to ipanacea)
Currently Being ModeratedMar 2, 2012 6:14 AM (in response to Glenn Leblanc)
I agree, the Guest account works like a charm and simply modifying the User Template to suit your environment is a breeze, but the Guest account isn't a solution in every instance.
I got it working for anyone that's interested…
I got this to work as a LogoutHook.
# Logout script to remove nonadmin accounts from Users folder
# If user is an admin, exit script
if [ $USER = "usernametosave" ]; then
# the next 2 lines could be substituted for the previous line
# dscl . -read /Groups/admin GroupMembership | grep -q "$USER"
# if [ "$? -eq 0"]; then
echo "LOGOUT: admin folders will not be deleted."
# If home directory exists, delete
if [ -d "/Users/$USER" ]; then
echo "LOGOUT: user account cleanup."
rm -R /Users/"$USER"
dscl . -delete /Users/"$USER"
And then you make the script executable and write to the com.apple.loginwindow file. Then each time someone logs out it runs the script.