When I recently took this position, I inherited a bit of a mess. We have recently deployed an image to 200+ macs in labs throughout our environment. The person I replaced implemented this script as a logout hook. The script as you can see really does not do when the author intended. It deletes the entire Users folder and all content! The reason she did this is to eliminate space issues (students saving large files and having their profiles remain after logging out), keychain issues, etc. I do like the idea of the creation of a new Users folder every time someone logs in but this a little too aggressive.
###
#!/bin/bash
#Deletes the temporary local user account in /Users, and leaves local admin account
cd /
#where local admin account is "asite"
if [ $USER = "asite" ];then
exit 1
fi
if [ $USER = "newnetid" ];then
exit 1
fi
if [ -d "Users/$USER" ]; then
rm -R /Users/"$USER"
dscl . -delete /Users/"$USER"
fi
exit 0
####
The issue I am battling is that iTunes wants the Shared folder to be present. Ideally, I would like another script that adds a silent login hook that places folder named Shared in the Users folder when a student logs in and be able to push it via a policy via jss.... I have tried various scripts but since Users is a system folder, I run into authentication errors.
Or, alternatively change the setting that specifies iTunes to use the Share Folder (may not be possible) and to something else (pushed via a policy).
Assumptions:
Yes, I could rebuild the images with this fixed but that would mean I would have to redeploy the images again and we are under a deadline as students are returning to class next week. Yes, it could be argued that using iTunes on a lab machine is not a good idea (the requirement was by faculty and out of my control).
I am going to rethink this when I build the next image for our labs.
If anyone needs me to clarify, please ask. Basically, I just need the simplest solution to the absence of the /Users/Shared folder that can be scripted and added to existing machines.
Thanks in advance!
/randy