X11 connection rejected because of wrong authentication

I have two Solaris 10 systems, A and B, both of which share home directories via NFS (served from a 3rd, Linux, machine). User names, uids, and home directories are identical when the same user has accounts on both Solaris 10 machines.

When I run

ssh -X user@A

from my home machine, I can easily run X11 apps. However, when I do

ssh -X user@B

, I get the following in response to commands:

X11 connection rejected because of wrong authentication.
X connection to well:11.0 broken (explicit kill or server shutdown).

Googling indicates that this problem often occurs in response to a disk full condition, but none of my file systems on either A or B are anywhere near full. Googling also turned up possibilities about TMPDIR pointing to a directory with invalid permissions (the TMPDIR on both systems is drwxrwxrwt, as it should be) or that the permissions on an existing .Xauthority file are incorrect (I tried moving this file out of the way with no change in being able to run X apps).

Further investigation seems to indicate that system B is unable to create or modify the .Xauthority file. Since "user" has full read/write/execute search to his home directory on both A and B, and has the same UID, he shouldn't have any problems updating the .Xauthority file. In fact, he can do "touch" to create the file on either system (once the old one is moved out of the way).

If I remove the .Xauthority file, and login to system A, I see:

 /usr/openwin/bin/xauth:  creating new authority file /home/.../.Xauthority

when I login, and the .Xauthority file exists. If I again remove the file, and login to system B, I don't see this message, and the file is not created. It doesn't get created even if I try running xauth

Any suggestions gratefully appreciated - I'm tired of banging my head against the wall on this.

---------- Post updated Mar 26th, 2010 at 11:31 ---------- Previous update was Mar 25th, 2010 at 12:56 ----------

Nobody with any suggestions? Is there a better place to ask?

---------- Post updated at 16:27 ---------- Previous update was at 11:31 ----------

I've figured this out on my own. SYstem B had an /etc/sshrc file, while system A did not have one. When there is an sshrc file, sshd does not run xauth when a user logs in - it has to be explictly run in some other way (such as in the sshrc or ~/.ssh/rc)

The init code looks like this, in case anybody else ever runs into this problem:

if read proto cookie && [ -n "$DISPLAY" ]; then
   if [ `echo $DISPLAY | cut -c1-10`  =  'localhost:' ]; then
      # X11UseLocalhost=yes      echo add unix:`echo $DISPLAY |
      cut -c11-` $proto $cookie   else             
      # X11UseLocalhost=no      echo add $DISPLAY $proto $cookie
   fi |   /usr/openwin/bin/xauth -q -
fi