Peter Rauen wrote:
sorry but I feel not comfortable in using a script i do not understand and which may work or not.
peter
Hi Peter,
The script does work, at least for me (I don't know exactly what and how the OP tried to do that), and you don't have anything to fear of.
We are working on an environment with 100+ iMac, and haven't had any issues since making this script.
I think maybe I've forgot to mention it on my comment here ( I did give a link to my original post, which is explained over there though )-
THIS SCRIPT MUST BE RUN ON THE CLIENTS COMPUTERS, NOT THE SERVER ITSELF !!!
As the OP of this post, and I in the post I've linked to, mentioned, the problem is that when a network user is logging out, the system doesn't actually log out from the network share, and therefore, when trying to log in as another network user, there is some sort of 'collision' between the two.
The server doesn't allow for the new network user to get access to his stuff, because he thinks that the last network user is still connected from the same computer.
You can view this by logging out as a network user, then logging in as an local user, opening Terminal (Finder->Go->Utilities->Terminal) and running the following command 'df -h'.
'df -h' simply give you a list of all mounted devices, which includes mounted network share points.
I've explained it in detail in my original post, I've posted a link to above, but I will explain it again here for you.
I'm not an native english speaker, so I'll do my best to be as clear as I can.
"do shell script" simply means that AppleScript Editor should run the following command as a command line command (like typing it in Terminal).
(line 1)
do shell script "sudo defaults write com.apple.loginwindow LogoutHook /Users/logouthook" with administrator privileges
The first line simply 'tells' the system to create a logout hook, meaning an action to be performed each time a user, no matter if local or network, is logging out.
It 'tells' the system that the action to be performed is to run the file 'logouthook' which can be found in the '/Users' directory.
(lines 2+3)
do shell script "echo $'#!bin/bash
umount -f /Network/Servers/MY.SERVER.NAME/Volumes/MOUNT.VOLUME' > /Users/logouthook" with administrator privileges
The second and third lines, which is one command (aka one "do shell script" command) is just creating the above 'logouthook' script itself.
It's begin with 'echo' command, which means just to display the following command on the screen,
Following this is '#!bin/bash' which is just the start definition of this type of script.
The line under is the actual command to be performed,
'umount' is the Terminal command to unmount, or eject, a device.
'umount -f' mean force unmount, meaning that even if device is in use, force it to eject,
This is kind of similar to having a USB that doesn't want to eject, so you just unplug it, the system doesn't care if it is in use.
Following that is the share point that you want to unmount, which you will need to adjust for your server mount point.
To get this, simply do as I've mentioned above- log in as a network user, log out, then log in as a local admin, open Terminal, and type 'df -h'.
You need to look for what appears under 'mounted on' which appears in the line of your network share point.
Next to that is the '> /Users/logouthook' which simply means, instead of displaying the following command on the screen, create a file named 'logouthook' save it in '/Users/' directory, and save all of the command that was beforehand into that file.
****** IMPORTANT NOTE ******
DO NOT (!!!!) make the second "do shell script" into one line !!!! It is constructed like that on purpose.
And also DO NOT (!!!!!) remove the apostrophe sign (this sign-> ' <-) from the end of the share point (which in my example is .....MOUNT.VOLUME')
If you do any of the above changes, IT WILL NOT WORK !!!!!
(line 4)
do shell script "sudo chmod +x /Users/logouthook" with administrator privileges
The fourth line (the third "do shell script") simply sets a +x permission to the file,
Which means that it allows it to be executed if any process try to.
(line 5)
do shell script "sudo chflags hidden /Users/logouthook" with administrator privileges
The fifth line (the fourth "do shell script") makes the file hidden.
We don't want anyone to enter /Users/ directory and accidentally throw our script to the trash.
Now, save this script as an .app (In AppleScript Editor click on File->Export and then choose to save it as 'Application')
This is done so it can be easily executed on each client computer.
Now copy it to some shared directory on your network, go to each client computer, log in as a local admin and run this script.
Reply if you need any more assistance, or if something isn't clear enough.
Cheers mate.