I can't help but wonder if you are seeing a race condition, perhaps something like this:
- User logs into an OS X client, which mounts the home folder over AFP
- User
ssh
es into a Linux host, which mounts the home that the OS X client has mounted, but does so over AFP.
- Linux host reads (writes?) to ~/.Xauthority and the file is locked -- either intentionally (as part of the checking process) or not (something the server does to prevent the same file from being written to by two systems using different protocols, or heck, to prevent two different systems from stomping on one file at the same time, regardless of protocol).
- Original Mac OS X client wants to record data about the session [aside: I really don't know what .Xauthority is used for] and tries to access the file
- It is told the file is locked
- About this time, the Linux box is done with the file, and it becomes unlocked
On a different attempt, it may be that:
1) they are attempting to connect to a known host and the OS X client doesn't need to record any information and doesn't access .Xauthority,
or
2) the timing is out enough that the two systems don't try to use the same file at the same time [hence this being a race condition].
I'm not certain how you could tell if this is the case. I think you could use the fs_usage
command on the server (or a GUI tool like fseventer) to see if the same file is being access in rapid succession, although that doesn't necessarily prove anything.
You might be able to glean useful information by using lsof
, on either the files or (lsof -i
) network connections. Possibly you could turn on logging for AFP and NFS (or use nfsstat
?) and cross reference them.
I'd consider compiling iftop, but, all you should see when running it is that, yes, there are connections to the server from both the Mac client and the Linux client, and they are using different ports and transferring information.
I'd recommend having a test user ssh in using different accounts on the Mac client and Linux host for a while and see if the issue comes up for them. If it doesn't, then it does have something to do with using the same account in two places at once (and quite likely due to mounting the home folder twice).
It may be worth seeing if you can configure OS X and Linux to use different copies of the Xauthority file. (I'm not sure if you can even do that).
I would also try having a test user access their home folder on OS X over NFS and see if that makes a difference.