For anyone who runs a Macintosh lab, you must visit Mike Bombich’s website. His advise, applications and scripts have made my life much easier and our labs running more efficiently.
Problem: Lately, I’ve had trouble with our student login not consistently working. The student would log in and the OS would run the script. However, if you brought up the finder window, there would be extra folders in the sidebar. Those extras were folders referencing the previous login. Files saved to the desktop were actually not being saved to the current login desktop but the previous login desktop folder.
Solution: Here are the changes that I made to the script. Its not as efficient but I believe its more consistent. If you want to see Mike’s original script, go to his script website as he holds the copyright. I use the “refresh-default-homedir-savetmp.sh” script.
# Move the home directory
mkdir -m 755 “${tmpDir}/prevuser.$time”
ditto $defHome “${tmpDir}/prevuser.$time”
# Copy a new default home directory from the user template
rm -rf /Users/$1
/usr/bin/ditto -rsrc $defTemplate $defHome
# Change the ownership of the new home directory to the user logging in
/usr/sbin/chown -R student $defHome