You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mavericks network homes

All running well in upgrade apart from one little issue.

When a network user logs into any computer on the network all goes well until he logs off. To the user he has logged of but the server still keeps him logged on.

This is an issue if he then tries to log onto another computer, where he finds that mail etc does not work because the last computer has his network home.

If he restarts the computer this releases the Network home or if I log in as admin perform the command


/sbin/umount -f /Network/Servers/mx.anyserver.co.uk/Volumes/Server/HomesUsers


So Help tried a logout script but that does not work.

Set up several test servers and each time this issue occurs.

the client (10.9) does not logout properly


Please help very important.


Last question to Apple do you test your software this was an obvious fault.

Posted on Nov 10, 2013 11:59 PM

Reply
49 replies

Jul 1, 2014 11:42 PM in response to William Bowden1

Have you tried my suggestion about the logout hook??


Becuase it is doing automatically what you've done manually using the admin account.


If you did, please explain exactly how you did it.


I would suggest copy-paste my code to apple script, and only change the mount point to yours

/Network/Servers/mx.anyserver.co.uk/Volumes/Server/HomesUsers

Jul 2, 2014 12:07 AM in response to AMI289

Just a reminder (instead of going to the original post I've posted the answer)



open AppleScript Editor (from Utilites folder),

and copy-paste the following



do shell script "sudo defaults write com.apple.loginwindow LogoutHook /Users/logouthook" with administrator privileges

do shell script "echo $'#!bin/bash

umount -f /Network/Servers/MY.SERVER.NAME/Volumes/MOUNT.VOLUME' > /Users/logouthook" with administrator privileges

do shell script "sudo chmod +x /Users/logouthook" with administrator privileges

do shell script "sudo chflags hidden /Users/logouthook" with administrator privileges



Just modify the "/Network/Servers/MY.SERVER.NAME/Volumes/MOUNT.VOLUME" to your server address

And don't accidently remove the apostrophe sign ( ' ) from after the server name, it will not work without it!!

ALSO- The second 'do shell script' is intentionally two lines - DO NOT MAKE IT ONE LINE!!!

Jul 3, 2014 8:37 AM in response to Peter Rauen

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.

Jul 3, 2014 4:41 PM in response to AMI289

Hi AMI289, I am trying to get your script to work but I am having issues. I think I know where the problem is and maybe you can help. My server name is myoffice.server.private and my network users home folders are located on /Network/Servers/myoffice.server.private/Volumes/Data/Office Users Folders, i think the problem is the spaces in the folder name, can you tell me how to modify the script to work for me , this issue has been bugging me for almost a year, I really appreciate any help.

Thanks Again

Jul 4, 2014 3:01 AM in response to Hector Castillo

Hi Hector,


You are correct!

The problem is the spaces.


And William was correct as well, but he was only half-way right.



You see, as I've mentioned, "do shell script" runs the command like you type it in Terminal,

And as William said, in order the make a literal space, you need to put a backslash before it (meaning 'Office Users Folders' become 'Office\ Users\ Folders').

That way, the Terminal knows that this space is part of the same 'item' (as opposed to 'cd DIRECTORY' for example, which means, do the 'cd' command, for the next item, which in this case is 'DIRECTORY'.


The thing is, that on AppleScript Editor (and I believe that in almost program languages for that matter), you have a special 'code-operations' which starts with a backslash sign, so if you want to get literal special signs (such as backslash, double-quoutes, etc.), you need to put a backslash before that, so that AppleScript Editor will 'understand' that you want to put the literal sign, and not do a special operation.


So because you want to 'tell' AppleScript Editor that you want to put a literal backslash, you need to put another backslash before the one you already added.

So your network share point now becomes 'Office\\ Users\\ Folders').



Just replace the line in my example with the line below, and you should be good to go-


umount -f /Network/Servers/myoffice.server.private/Volumes/Data/Office\\ Users\\ Folders' > /Users/logouthook" withadministrator privileges

Just a tip mate,

Before saving it as an Application,

Open AppleScript Editor on a client computer, paste the whole code to it,

On the bottom, go to the 'Events' tab (clicking it will show both 'Events' and 'Replies', if it doesn't, just click on 'Replies' as well)

And run the script,

Watch to see if you have any errors,

If not, you can then save it as an Application, and manually run it on all clients computers


Good luck mate,


Post back if everything is working, or if you need any more assistance

Mavericks network homes

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.