Documents and Downloads folders are recreated when new user logs in

rjfnyu
New Contributor

Hello,

We have an environment where many AD users are logging into lab computers, so new home folders are constantly created from the User Template. Starting in Lion if you had replaced the Downloads folder or the Documents folder with a symbolic link within the User Template, the OS would automatically recreated those two folders upon a new user logging in. With both Lion and Mountain Lion, we used to be able to run a script on login that deleted the newly created Documents and Downloads folders and then created the symbolic links. It was not ideal, but it did work consistently. Now with Mavericks, I cannot run a script to delete the folders and create the symbolic links as I think that the process that creates the Documents and Downloads folders runs after a LoginHook or a LaunchAgent. Does anyone know what process does this (I believe that it was the dock daemon in Lion and Mountain Lion) and how I can keep the symbolic links for each new user? I would rather disable that part of the process rather than run the script.

Also, please let me know if you think that my entire approach is incorrect.

Thanks,

Rob

2 REPLIES 2

davidacland
Honored Contributor II
Honored Contributor II

From what I have seen, a lot of these folders are recreated / created as they are needed. The Downloads folder (for example) isn't needed at the point of login but if you opened Safari and downloaded something, it would be created at that point.

Could you use your script to check if the folders exist, delete them if they do (making sure there is no user data in there!) and replace with symbolic links, otherwise just go straight to the symbolic link step? (I'm assuming that if the symbolic link is in place, the finder won't delete it and replace it with a folder).

rjfnyu
New Contributor

The folders only are created when a new home folder is created. If you alter it and then log out and log back in again, the alteration will stick. The only problem is that we have new home folders being constantly created and then all home folders are deleted when the computer restarts so they do not accumulate. Keeping the user's work outside of the home folder prevents it from being deleted in case of a crash or accidental loss of power. The Downloads folder is not recreated when you download something with Safari if a symbolic link is already there.

The script deletes the Documents and Downloads folders and then recreates them as symbolic links to a folder on the root of the hard drive. In Lion and Mountain Lion, this worked like a charm and there was no interference from the OS. In Mavericks my script runs that leaves the symbolic links, but then something from the OS recreates those folders after. I ideally would like to disable whatever is creating those two folders.