|
Instructions on cleaning Netinfo Manager and the disappearing network folders: Summary of Problem: Mac OS X users logging into our Windows managed Active Directory Network sometimes had no network folder in their dock or desktop. Description: We found that on certain computers when certain users logged in, they would not get a network folder. This problem arose because Netinfo Manager was caching certain network settings. If a user got cached, they would be unable to ever get their network folder on that computer. The solution was to open the utilities folder, then Netinfo Manager, then click on MCX_Cache, then click on Users and choose delete. Also, to check in Netinfo Manager, then Users, for the users login name. If a person was in the Users section of Netinfo Manager, they could have their password rejected (often their name showed up twice in it). Network users in the Netinfo/Users folder could be safely deleted. This had no adverse side effects and restored the user's network folder. But, users might then have their settings cached on the same computer again or a different computer later. This led to a few emails a week about disappearing network folders. Solution: The solution was then to make a script to clear the MCX_Cache, so every time a user logged out the Mac would clear the MCX_Cache and remove the user from the NetinfoManager's Users folder. I found that there was a command in a terminal, "niutil", that had an option "-destroy" to delete information in the Netinfo manager. So first I made a simple script. I called it "logout.sh" #!/bin/bash #This line runs niutil and tells it to destroy everything in MCX_Cache. We can safely destroy everything in mcx_cache as nothing of use is in there. niutil -destroy . /mcx_cache/users #As a logout script, this is automatically ran as root. The username is passed to the script as $1. I change $1 to username, just to make things easier to read. username=$1 #Now we run a check to make sure we don't delete root or administrator. Deleting root will force you to reinstall the OS (I personally know). This is a multiple if statement. Case begins the statement and esac ends it. case "$username" in 'administrator') exit ;; 'root') exit ;; esac #Now we have the last user logged in, we know it is not root or admin, so we can delete it safely. Again we use niutil and destroy. niutil -destroy . /users/$username On our network, the only local accounts are "administrator" and "root." If your computers have more local accounts, add their names too. If you delete a local account from NetinfoManager, you will not be able to log into it. Delete root and you will have to reinstall the OS. Now I needed this script to run at logout. To run niutil, you need root rights, but with logout scripts, they run automatically as root. With the terminal, you can modify what scripts are run at login. To do this, open a terminal. Then: In 10.4.x type "sudo defaults write com.apple.loginwindow LogoutHook [path to your script]." In 10.3.x type "sudo defaults write /Library/Preferences/com.apple.loginwindow LogoutHook [path to your script]" In our case, we kept the script on a 10.4 mac in a folder called logoutscript in the base of the HD. Thus, the terminal command was "sudo defaults write com.apple.loginwindow LogoutHook /logoutscript/logout.sh" One final note, make the script, "logout.sh" only read and writable by root. Otherwise someone could edit the file and run any command at logout. After all that, the script would clear /mcx_cache/users and /Users/(last person logged in) every time at logout and network folders appeared all the time. |